/// <summary> /// Flush vessels older than 20 seconds /// </summary> private void FlushRemovedVessels() { var vesselsToFlush = RemovedVessels .Where(v => (LunaNetworkTime.UtcNow - v.Value) > TimeSpan.FromSeconds(20)) .Select(v => v.Key); foreach (var vesselId in vesselsToFlush) { RemovedVessels.TryRemove(vesselId, out _); } }
/// <summary> /// Flush vessels older than <see cref="MaxTimeToKeepVesselsInRemoveListMs"/> seconds /// </summary> private void FlushRemovedVessels() { var vesselsToFlush = RemovedVessels .Where(v => (LunaNetworkTime.UtcNow - v.Value) > TimeSpan.FromMilliseconds(MaxTimeToKeepVesselsInRemoveListMs)) .Select(v => v.Key); foreach (var vesselId in vesselsToFlush) { RemovedVessels.TryRemove(vesselId, out _); } }