public CircuitBreakerState Trip(Exception exception, CircuitBreakerState currentState)
        {
            var now     = ticksFn();
            var horizon = now - interval;
            int count;

            lock (wsync)
            {
                errors.Add(now);
                count = errors.CountItems(x => x > horizon);
            }

            if (count > maxErrorsInInterval)
            {
                return(CircuitBreakerState.Open);
            }

            return(count > 0 ? CircuitBreakerState.HalfOpen : CircuitBreakerState.Closed);
        }