Files
notifications-admin/app/notify_client/performance_dashboard_api_client.py
Chris Hill-Scott 545f933e37 Cache the JSON in Redis
The endpoints are probably fast enough, but it seems risky to have a
public URL which causes a new query every time the page is loaded.
2021-03-12 14:43:58 +00:00

23 lines
561 B
Python

from app.notify_client import NotifyAdminAPIClient, cache
class PerformanceDashboardAPIClient(NotifyAdminAPIClient):
@cache.set('performance-stats-{start_date}-to-{end_date}')
def get_performance_dashboard_stats(
self,
*,
start_date,
end_date,
):
return self.get(
'/performance-dashboard',
params={
'start_date': str(start_date),
'end_date': str(end_date),
}
)
performance_dashboard_api_client = PerformanceDashboardAPIClient()