public void Does_nothing_when_node_is_not_outdated() { PrepareNodes(); tracker.DiscardOutdatedNodes(); A.CallTo(() => store.RemoveNode(null)).WithAnyArguments().MustNotHaveHappened(); A.CallTo(() => mediator.Publish(null)).WithAnyArguments().MustNotHaveHappened(); }
public void DiscardOutdatedNodes() { logger.Debug("Discarding outdated nodes"); var now = timeProvider.Now(); var toRemove = csDataStore.ConnectedNodes .Where(n => now - n.LastStatusMessageTime > communicationsServerConfiguration.CommunicationsTimeoutTimeSpan) .ToList(); foreach (var n in toRemove) { logger.Warn($"Node {n.Id} discarded as not responding."); csDataStore.RemoveNode(n); mediator.Publish(new NodeRemoved(n.Id)); } }