Skip to content

Commit

Permalink
use config variable for deliver_sms rate limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
sastels committed Sep 13, 2023
1 parent 9f06fae commit 85b9a2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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
2 changes: 1 addition & 1 deletion app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +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]")

FROM_NUMBER = "development"
Expand Down

0 comments on commit 85b9a2e

Please sign in to comment.