protected override void OnMessage(T msg) { lock (BatchLock) { if (!_flushPending) { Fiber.Schedule(Flush, Interval); _flushPending = true; } _pending = msg; } }
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; } }
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); }