diff --git a/app/service/rest.py b/app/service/rest.py index 5452c2dc22..d3c790d841 100644 --- a/app/service/rest.py +++ b/app/service/rest.py @@ -5,8 +5,10 @@ from notifications_utils.clients.redis import ( daily_limit_cache_key, near_daily_limit_cache_key, + near_email_daily_limit_cache_key, near_sms_daily_limit_cache_key, over_daily_limit_cache_key, + over_email_daily_limit_cache_key, over_sms_daily_limit_cache_key, ) from notifications_utils.letter_timings import letter_can_be_cancelled @@ -303,6 +305,8 @@ def update_service(service_id): redis_store.delete(daily_limit_cache_key(service_id)) redis_store.delete(near_daily_limit_cache_key(service_id)) redis_store.delete(over_daily_limit_cache_key(service_id)) + redis_store.delete(near_email_daily_limit_cache_key(service_id)) + redis_store.delete(over_email_daily_limit_cache_key(service_id)) if not fetched_service.restricted: _warn_service_users_about_message_limit_changed(service_id, current_data) if sms_limit_changed: diff --git a/tests/app/service/test_rest.py b/tests/app/service/test_rest.py index 4cd0cc5b90..d5f01b415d 100644 --- a/tests/app/service/test_rest.py +++ b/tests/app/service/test_rest.py @@ -11,7 +11,9 @@ from notifications_utils.clients.redis import ( daily_limit_cache_key, near_daily_limit_cache_key, + near_email_daily_limit_cache_key, over_daily_limit_cache_key, + over_email_daily_limit_cache_key, ) from app.clients.salesforce.salesforce_engagement import ENGAGEMENT_STAGE_LIVE @@ -2181,6 +2183,8 @@ def test_update_service_updating_daily_limit_clears_redis_cache( call(daily_limit_cache_key(service.id)), call(near_daily_limit_cache_key(service.id)), call(over_daily_limit_cache_key(service.id)), + call(near_email_daily_limit_cache_key(service.id)), + call(over_email_daily_limit_cache_key(service.id)), ] else: redis_delete.assert_not_called()