Beispiel #1
0
        private void SendSessions(object state)
        {
            Dictionary <IConfiguration, Dictionary <string, long> > sessionData = new Dictionary <IConfiguration, Dictionary <string, long> >();

            lock (_lock)
            {
                foreach (var item in _store)
                {
                    sessionData[item.Key] = new Dictionary <string, long>(item.Value);
                    _store[item.Key].Clear();
                }
            }

            foreach (var item in sessionData)
            {
                var payload = new BatchedSessions(item.Key, item.Value);
                ThreadQueueDelivery.Instance.Send(payload);
            }
        }
Beispiel #2
0
        private void SendSessions(object state)
        {
            Dictionary <IConfiguration, Dictionary <string, long> > sessionData = new Dictionary <IConfiguration, Dictionary <string, long> >();

            lock (_lock)
            {
                // we only care about entries that have session data
                foreach (var item in _store.Where(d => d.Value.Any()))
                {
                    sessionData[item.Key] = new Dictionary <string, long>(item.Value);
                    _store[item.Key].Clear();
                }
            }

            foreach (var item in sessionData)
            {
                var payload = new BatchedSessions(item.Key, item.Value);
                ThreadQueueDelivery.Instance.Send(payload);
            }
        }