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(); }
public Dictionary <PeerId, int> GetNonAckedMessageCountsForUpdatedPeers() { return(_peerStateRepository.GetUpdatedPeers(ref _lastNonAckedMessageCountsVersion) .ToDictionary(x => x.PeerId, x => x.NonAckedMessageCount)); }