Skip to content

Commit

Permalink
Delete cache key so we resend warning email (#2056)
Browse files Browse the repository at this point in the history
* start

* added info for test
  • Loading branch information
jzbahrai authored Dec 6, 2023
1 parent 7b249ad commit 388df4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/service/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions tests/app/service/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 388df4e

Please sign in to comment.