mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
randomly choose from providers based on priority
todo: make sure if they don't add up to 100 we do something sensible, especially if they're both 0.
This commit is contained in:
@@ -116,14 +116,13 @@ def switch_current_sms_provider_on_slow_delivery():
|
||||
if current_provider.updated_at > datetime.utcnow() - timedelta(minutes=10):
|
||||
current_app.logger.info("Slow delivery notifications provider switched less than 10 minutes ago.")
|
||||
return
|
||||
slow_delivery_notifications = is_delivery_slow_for_provider(
|
||||
provider=current_provider.identifier,
|
||||
slow_delivery_notifications = is_delivery_slow_for_providers(
|
||||
threshold=0.3,
|
||||
created_at=datetime.utcnow() - timedelta(minutes=10),
|
||||
delivery_time=timedelta(minutes=4),
|
||||
)
|
||||
|
||||
if slow_delivery_notifications:
|
||||
if slow_delivery_notifications[current_provider]:
|
||||
current_app.logger.warning(
|
||||
'Slow delivery notifications detected for provider {}'.format(
|
||||
current_provider.identifier
|
||||
|
||||
Reference in New Issue
Block a user