Set the bandmap spot timeout separately for CW/digital and phone
CW and digital spots time out after 10 minutes and phone spots after 30 by default, both settings on the telnet Filters tab. The mode comes from the band plan; a frequency it has no boundaries for counts as phone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,10 +26,14 @@ public sealed class Bandmap
|
||||
this.clock = clock ?? (() => DateTime.UtcNow);
|
||||
}
|
||||
|
||||
/// How long a spot stays on the map. N1MM asks for the same number in
|
||||
/// minutes, on the telnet window's Filters tab.
|
||||
/// How long a spot stays on the map when `LifetimeFor` is not set.
|
||||
public TimeSpan Lifetime { get; set; }
|
||||
|
||||
/// How long a given spot stays on the map, for a different time in each
|
||||
/// mode. N1MM asks for one number in minutes, on the telnet window's
|
||||
/// Filters tab.
|
||||
public Func<Spot, TimeSpan>? LifetimeFor { get; set; }
|
||||
|
||||
public event EventHandler? Changed;
|
||||
|
||||
public void Add(Spot spot)
|
||||
@@ -85,7 +89,8 @@ public sealed class Bandmap
|
||||
lock (guard)
|
||||
{
|
||||
List<string> stale = spots
|
||||
.Where(pair => nowUtc - arrived.GetValueOrDefault(pair.Key, nowUtc) > Lifetime)
|
||||
.Where(pair => nowUtc - arrived.GetValueOrDefault(pair.Key, nowUtc)
|
||||
> (LifetimeFor?.Invoke(pair.Value) ?? Lifetime))
|
||||
.Select(pair => pair.Key)
|
||||
.ToList();
|
||||
foreach (string key in stale)
|
||||
|
||||
Reference in New Issue
Block a user