public override void DoPeriodicAction()
        {
            var isGlobalCheck = SystemDateTime.UtcNow >= _lastGlobalCheck.Add(_configuration.OldestMessagePerPeerGlobalCheckPeriod);

            if (isGlobalCheck)
            {
                _lastCheckVersion = 0;
                _lastGlobalCheck  = SystemDateTime.UtcNow;
            }

            var peersToCheck = _peerStateRepository.GetUpdatedPeers(ref _lastCheckVersion);

            Parallel.ForEach(peersToCheck, new ParallelOptions {
                MaxDegreeOfParallelism = 10
            }, UpdateOldestNonAckedMessage);

            _peerStateRepository.Save();
        }
Exemplo n.º 2
0
 public void Stop()
 {
     Dispose();
     _peerStateRepository.Save().Wait(2.Seconds());
 }