public async Task <IEnumerable <IDelayedMessage> > Pull(string channel, string key = null, int?max = null) { var specificKey = new Tuple <string, string>(channel, key); Logger.Write(LogLevel.Debug, () => $"Pulling delayed channel [{channel}] key [{key}] max [{max}]"); var fromCache = await _cache.Pull(channel, key, max).ConfigureAwait(false); List <IDelayedMessage> discovered = new List <IDelayedMessage>(fromCache); List <IDelayedMessage> fromUncommitted; if (_uncommitted.TryRemove(specificKey, out fromUncommitted)) { discovered.AddRange(fromUncommitted); } if (discovered.Any()) { _inFlightMemCache.TryAdd(specificKey, discovered); } Logger.Write(LogLevel.Info, () => $"Pulled {discovered.Count} from delayed channel [{channel}] key [{key}]"); return(discovered); }
public async Task <IEnumerable <IDelayedMessage> > Pull(string channel, string key = null, int?max = null) { var specificKey = new Tuple <string, string>(channel, key); var fromCache = await _cache.Pull(channel, key, max).ConfigureAwait(false); var discovered = new List <IDelayedMessage>(fromCache); if (_uncommitted.TryRemove(specificKey, out var fromUncommitted)) { discovered.AddRange(fromUncommitted); } if (discovered.Any()) { _inFlightMemCache.TryAdd(specificKey, discovered); } return(discovered); }