expired alarms aus der Liste ausfiltern, Testing steht noch aus

This commit is contained in:
Daniel Schick 2023-01-11 12:52:56 +01:00
parent 24f0400ab0
commit 6a11764fe2
2 changed files with 5 additions and 1 deletions

View File

@ -49,6 +49,7 @@ namespace bsmd.AIS2Service
{ {
_sitRepList.TryAdd(key, targets[key]); _sitRepList.TryAdd(key, targets[key]);
} }
_log.InfoFormat("preloaded {0} targets", _sitRepList.Count);
foreach (var task in _tasks) foreach (var task in _tasks)
{ {

View File

@ -15,10 +15,13 @@ namespace bsmd.AIS2Service
if (!id.HasValue) return null; if (!id.HasValue) return null;
List<ShipLocationReport> result = AISManager.SQLiteStorage.GetShipLocationReports(id.Value); List<ShipLocationReport> result = AISManager.SQLiteStorage.GetShipLocationReports(id.Value);
// Class B targets entfernen
int classBReportCnt = result.RemoveAll(x => AISManager.SitRep.ContainsKey(x.MMSI) && (AISManager.SitRep[x.MMSI].IsClassB ?? false)); int classBReportCnt = result.RemoveAll(x => AISManager.SitRep.ContainsKey(x.MMSI) && (AISManager.SitRep[x.MMSI].IsClassB ?? false));
_log.DebugFormat("removed {0} class B SLR reports from list"); // tut des? _log.DebugFormat("removed {0} class B alarms from list"); // tut des?
// auch alles entfernen was "abgelaufen" ist und nicht im SitRep enthalten ist // auch alles entfernen was "abgelaufen" ist und nicht im SitRep enthalten ist
int expiredCnt = result.RemoveAll(x => AISManager.SitRep.ContainsKey(x.MMSI) && ((DateTime.Now - x.Timestamp_Last).TotalMinutes > 1440));
_log.InfoFormat("removed {0} expired (> 1 day) alarms from list");
Dictionary<int, List<ShipLocationReport>> mmsiDict = new Dictionary<int, List<ShipLocationReport>>(); Dictionary<int, List<ShipLocationReport>> mmsiDict = new Dictionary<int, List<ShipLocationReport>>();
foreach(ShipLocationReport report in result) { foreach(ShipLocationReport report in result) {