mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Fix some bugginess with how expired alerts and alert max_duration were handled. Closes #34
This commit is contained in:
@@ -35,11 +35,8 @@ class AlertProvider:
|
||||
for alert in alerts:
|
||||
# Fill in any blanks
|
||||
alert.infer_missing()
|
||||
# Add to the list, provided it meets the semsible date test. If alerts have an end time, it must be in the
|
||||
# future, or if not, then the start date must be at least in the last 24 hours.
|
||||
if (alert.end_time and alert.end_time > datetime.now(pytz.UTC).timestamp()) or (
|
||||
not alert.end_time and alert.start_time > (datetime.now(
|
||||
pytz.UTC) - timedelta(days=1)).timestamp()):
|
||||
# Add to the list, provided it heas not already expired.
|
||||
if not alert.expired():
|
||||
self.alerts.add(alert.id, alert, expire=MAX_ALERT_AGE)
|
||||
|
||||
# Stop any threads and prepare for application shutdown
|
||||
|
||||
Reference in New Issue
Block a user