mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Expire test and operator alerts after 4 hours
While testing alerts on these channels the MNOs sometimes need to restart their CBCs to make sure everything is failing over properly. If the CBC does not come back up, for whatever reason, then we are left in a state where the alert can’t be cancelled. To minimise the impact to the public in this scenario we should keep the expiry time at 4 hours for alerts sent on test channels. We recently increased it back up to 24 hours for all channels, so this in effect is reverting that change for channels that won’t be used in a real emergency.
This commit is contained in:
@@ -248,12 +248,15 @@ class BroadcastMessage(JSONModel):
|
||||
def request_approval(self):
|
||||
self._set_status_to('pending-approval')
|
||||
|
||||
def approve_broadcast(self):
|
||||
def approve_broadcast(self, channel):
|
||||
if channel in {'test', 'operator'}:
|
||||
ttl = timedelta(hours=4, minutes=0)
|
||||
else:
|
||||
ttl = timedelta(hours=23, minutes=59)
|
||||
|
||||
self._update(
|
||||
starts_at=datetime.utcnow().isoformat(),
|
||||
finishes_at=(
|
||||
datetime.utcnow() + timedelta(hours=23, minutes=59)
|
||||
).isoformat(),
|
||||
finishes_at=(datetime.utcnow() + ttl).isoformat(),
|
||||
)
|
||||
self._set_status_to('broadcasting')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user