Пример #1
0
        internal bool IsStable(Type type)
        {
            if (TypeFailures.ContainsKey(type))
            {
                return(TypeFailures[type].Count < ErrorCount);
            }

            return(true);
        }
Пример #2
0
        internal void AddFailure(Type type)
        {
            if (TypeFailures.ContainsKey(type))
            {
                TypeFailures[type].Add(DateTimeOffset.Now);
            }
            else
            {
                TypeFailures[type] = new List <DateTimeOffset> {
                    DateTimeOffset.Now
                };
            }

            // Trim the expired events
            TypeFailures[type].RemoveAll(x => x < DateTimeOffset.Now.Subtract(ErrorWindow));
        }