internal TimedBufferingConsumer(IConsumer <T> consumer, TimeSpan waitTime, IThreadingTimer timer) { _consumer = GaxPreconditions.CheckNotNull(consumer, nameof(consumer)); _timer = GaxPreconditions.CheckNotNull(timer, nameof(timer)); // Initialize the timer to flush ever wait time interval. _timer.Initialize((e) => { Flush(); }, waitTime); }
internal TimedBufferingConsumer(IConsumer <T> consumer, TimeSpan waitTime, IThreadingTimer timer) { _consumer = GaxPreconditions.CheckNotNull(consumer, nameof(consumer)); _timer = GaxPreconditions.CheckNotNull(timer, nameof(timer)); // Initialize the timer to flush ever wait time interval. _timer.Initialize((e) => { try { Flush(); } catch (Exception) { // TODO(talarico): This is a short term solution to ensure // we do not kill a process. See issue #2182 to track the long solution. } }, waitTime); }
internal TimedBufferingConsumer(IConsumer <T> consumer, TimeSpan waitTime, IThreadingTimer timer) { _consumer = GaxPreconditions.CheckNotNull(consumer, nameof(consumer)); _timer = GaxPreconditions.CheckNotNull(timer, nameof(timer)); // Initialize the timer to flush ever wait time interval. _timer.Initialize((e) => { try { Flush(); } catch (RpcException) { // TODO(talarico): This is a short term solution to ensure // we do not kill a process. See issue #842 to track the long term solution. // This solution is dependent on implementation details specifically the fact // that all consumers that make requests are gRPC based. } }, waitTime); }