Exemple #1
0
        private void ScheduleFlush(IChannelHandlerContext context)
        {
            // Schedule a recurring flush - only fires when there's writable data
            var task = new FlushTask(context, Settings.FlushInterval, this);

            context.Executor.Schedule(task, Settings.FlushInterval);
        }
 private void ScheduleFlush(IChannelHandlerContext ctx)
 {
     if (_nextScheduledFlushCts is null)
     {
         var cts       = new CancellationTokenSource();
         var flushTask = new FlushTask(this, cts);
         // Run as soon as possible, but still yield to give a chance for additional writes to enqueue.
         ctx.Channel.EventLoop.Execute(flushTask);
         _nextScheduledFlushCts = cts;
     }
 }