mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-08 04:13:41 -05:00
This stat is shown on a few of our pages, such as our homepage, the performance page and also a platform admin page and is currently catched for the default TTL of 1 week. I think there is no reason we can't make this only cache once an hour and give slightly more up to date stats which will update more regularly. This mimics the approach and also the TTL choice of 1 hour that has been added for the performance page (although there is no particular bug here to fix, it is just nice to have slightly more up up to date data). Note, the API call only takes about 0.3 seconds at the moment so it is not particularly intensive on the DB to run this more regularly.
15 lines
444 B
Python
15 lines
444 B
Python
from app.notify_client import NotifyAdminAPIClient, cache
|
|
|
|
|
|
class StatusApiClient(NotifyAdminAPIClient):
|
|
|
|
def get_status(self, *params):
|
|
return self.get(url='/_status', *params)
|
|
|
|
@cache.set('live-service-and-organisation-counts', ttl_in_seconds=3600)
|
|
def get_count_of_live_services_and_organisations(self):
|
|
return self.get(url='/_status/live-service-and-organisation-counts')
|
|
|
|
|
|
status_api_client = StatusApiClient()
|