Skip to content

Commit

Permalink
use config variable for deliver_sms rate limiting (#1979)
Browse files Browse the repository at this point in the history
Co-authored-by: Jimmy Royer <[email protected]>
  • Loading branch information
sastels and jimleroyer authored Sep 14, 2023
1 parent da75e8e commit 097b182
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/celery/provider_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from sqlalchemy.orm.exc import NoResultFound

from app import notify_celery
from app.config import QueueNames
from app.config import Config, QueueNames
from app.dao import notifications_dao
from app.dao.notifications_dao import update_notification_status_by_id
from app.delivery import send_to_providers
Expand Down Expand Up @@ -47,7 +47,7 @@ def deliver_throttled_sms(self, notification_id):
name="deliver_sms",
max_retries=48,
default_retry_delay=300,
rate_limit="1/s",
rate_limit=Config.CELERY_DELIVER_SMS_RATE_LIMIT,
)
@statsd(namespace="tasks")
def deliver_sms(self, notification_id):
Expand Down
1 change: 1 addition & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ class Config(object):
# },
}
CELERY_QUEUES: List[Any] = []
CELERY_DELIVER_SMS_RATE_LIMIT = os.getenv("CELERY_DELIVER_SMS_RATE_LIMIT", "1/s")

CONTACT_FORM_EMAIL_ADDRESS = os.getenv("CONTACT_FORM_EMAIL_ADDRESS", "[email protected]")

Expand Down

0 comments on commit 097b182

Please sign in to comment.