-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sms-soak-test
- Loading branch information
Showing
18 changed files
with
1,186 additions
and
1,625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import Any, Dict | ||
|
||
from flask import current_app | ||
|
||
from app.config import QueueNames | ||
from app.models import BULK, NORMAL, PRIORITY, SMS_TYPE | ||
|
||
# Default retry periods for sending notifications. | ||
RETRY_DEFAULT = 300 | ||
RETRY_HIGH = 25 | ||
|
||
RETRY_PERIODS = { | ||
BULK: RETRY_DEFAULT, | ||
NORMAL: RETRY_DEFAULT, | ||
PRIORITY: RETRY_HIGH, | ||
} | ||
|
||
|
||
def build_retry_task_params(notification_type: str, notification_process_type: str) -> Dict[str, Any]: | ||
""" | ||
Build task params for the sending parameter retry tasks. | ||
If the notification is a high priority SMS, set the retry policy to retry every 25 seconds | ||
else fall back to the default retry policy of retrying every 5 minutes. | ||
""" | ||
params: dict[str, Any] = {"queue": QueueNames.RETRY} | ||
if current_app.config["FF_CELERY_CUSTOM_TASK_PARAMS"] is False: | ||
return params | ||
|
||
# Overring the retry policy is only supported for SMS for now; | ||
# email support coming later. | ||
if notification_type == SMS_TYPE: | ||
params["countdown"] = RETRY_PERIODS[notification_process_type] | ||
else: | ||
params["countdown"] = RETRY_DEFAULT | ||
return params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
# runs the celery beat process. This runs the periodic tasks | ||
|
||
set -e | ||
|
||
celery -A run_celery.notify_celery beat --loglevel=INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.