예제 #1
0
        public Task ConsumeFault <T>(ConsumeContext <T> context, Exception exception)
            where T : class
        {
            if (_killSwitch.ExceptionFilter.Match(exception))
            {
                _killSwitch.Stop(_exception, this);
            }

            return(TaskUtil.Completed);
        }
예제 #2
0
        public async Task ConsumeFault <T>(ConsumeContext <T> context, Exception exception)
            where T : class
        {
            if (_killSwitch.ExceptionFilter.Match(exception))
            {
                var failureCount = Interlocked.Increment(ref _failureCount);

                if (IsActive && TripThresholdExceeded(failureCount))
                {
                    _killSwitch.Stop(exception, this);
                    _timer?.Dispose();
                }
            }
        }