mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
Merge pull request #1198 from alphagov/fix-redis-error
Stop redis cache from throwing an error
This commit is contained in:
@@ -76,7 +76,10 @@ def get_template_statistics_for_7_days(limit_days, service_id):
|
||||
if not template_stats_by_id:
|
||||
stats = dao_get_template_usage(service_id, limit_days=limit_days)
|
||||
cache_values = dict([(x.template_id, x.count) for x in stats])
|
||||
redis_store.set_hash_and_expire(cache_key, cache_values, current_app.config.get('EXPIRE_CACHE_IN_SECONDS', 600))
|
||||
if cache_values:
|
||||
redis_store.set_hash_and_expire(cache_key,
|
||||
cache_values,
|
||||
current_app.config.get('EXPIRE_CACHE_IN_SECONDS', 600))
|
||||
else:
|
||||
stats = dao_get_templates_for_cache(template_stats_by_id.items())
|
||||
return stats
|
||||
|
||||
Reference in New Issue
Block a user