Example #1
0
 protected override void OnMessage(T msg)
 {
     lock (BatchLock)
     {
         if (!_flushPending)
         {
             Fiber.Schedule(Flush, Interval);
             _flushPending = true;
         }
         _pending = msg;
     }
 }
Example #2
0
 protected override void OnMessage(T msg)
 {
     lock (BatchLock)
     {
         if (_pending == null)
         {
             _pending = new List <T>();
             Fiber.Schedule(Flush, Interval);
         }
         _pending.Add(msg);
     }
 }
 protected override void OnMessage(T msg)
 {
     lock (BatchLock)
     {
         TKey key = _keyResolver(msg);
         if (_pending == null)
         {
             _pending = new Dictionary <TKey, T>();
             Fiber.Schedule(Flush, Interval);
         }
         _pending[key] = msg;
     }
 }
Example #4
0
        protected override Task OnMessageAsync(T msg)
        {
            lock (BatchLock)
            {
                TKey key = _keyResolver(msg);
                if (_pending == null)
                {
                    _pending = new Dictionary <TKey, T>();
                    Fiber.Schedule(FlushAsync, Interval);
                }

                _pending[key] = msg;
            }

            return(Task.CompletedTask);
        }