コード例 #1
0
        public async Task End(Exception ex = null)
        {
            if (ex != null)
            {
                Logger.Write(LogLevel.Debug, () => $"UOW exception - putting {_inFlightMemCache.Count()} in flight channels back into memcache");
                foreach (var inflight in _inFlightMemCache)
                {
                    await _cache.Add(inflight.Key.Item1, inflight.Key.Item2, inflight.Value.ToArray()).ConfigureAwait(false);
                }
            }

            if (ex == null)
            {
                Logger.Write(LogLevel.Debug, () => $"Putting {_uncommitted.Count()} delayed streams into mem cache");

                _inFlightMemCache.Clear();

                foreach (var kv in _uncommitted)
                {
                    if (!kv.Value.Any())
                    {
                        return;
                    }

                    await _cache.Add(kv.Key.Item1, kv.Key.Item2, kv.Value.ToArray());
                }
            }
        }
コード例 #2
0
        public async Task End(Exception ex = null)
        {
            if (ex != null)
            {
                Logger.InfoEvent("UOWException", "{InFlight} messages back into cache", _inFlightMemCache.Count);
                foreach (var inflight in _inFlightMemCache)
                {
                    await _cache.Add(inflight.Key.Item1, inflight.Key.Item2, inflight.Value.ToArray()).ConfigureAwait(false);
                }
            }

            if (ex == null)
            {
                Logger.DebugEvent("UOWEnd", "{Uncommitted} streams into mem cache", _uncommitted.Count);

                _inFlightMemCache.Clear();

                foreach (var kv in _uncommitted)
                {
                    if (!kv.Value.Any())
                    {
                        return;
                    }

                    await _cache.Add(kv.Key.Item1, kv.Key.Item2, kv.Value.ToArray()).ConfigureAwait(false);
                }
            }
        }