2022-07-19 18:23:48 -07:00
|
|
|
import os
|
2019-04-10 17:20:51 +01:00
|
|
|
from app.notify_client import NotifyAdminAPIClient, cache
|
2022-07-19 18:23:48 -07:00
|
|
|
from flask import current_app
|
2016-11-30 17:01:44 +00:00
|
|
|
|
|
|
|
|
class StatusApiClient(NotifyAdminAPIClient):
|
2016-01-29 14:41:07 +00:00
|
|
|
|
|
|
|
|
def get_status(self, *params):
|
2016-04-06 16:36:03 +01:00
|
|
|
return self.get(url='/_status', *params)
|
2018-10-26 15:39:32 +01:00
|
|
|
|
2022-07-19 18:23:48 -07:00
|
|
|
# @cache.set('live-service-and-organisation-counts', ttl_in_seconds=3600)
|
2019-04-10 17:20:51 +01:00
|
|
|
def get_count_of_live_services_and_organisations(self):
|
2022-07-19 18:23:48 -07:00
|
|
|
current_app.logger.info("Getting count of live services and organisations")
|
|
|
|
|
current_app.logger.info("Redis url from config is: {}".format(current_app.config['REDIS_URL']))
|
|
|
|
|
current_app.logger.info("Redis url from env is: {}".format( os.environ.get('REDIS_URL') ))
|
|
|
|
|
current_app.logger.info("Redis enabled from config is: {}".format(current_app.config['REDIS_ENABLED']))
|
|
|
|
|
current_app.logger.info("Redis enabled from env is: {}".format( os.environ.get('REDIS_ENABLED') ))
|
2019-04-10 17:20:51 +01:00
|
|
|
return self.get(url='/_status/live-service-and-organisation-counts')
|
|
|
|
|
|
2022-07-19 18:23:48 -07:00
|
|
|
def get_services(self):
|
|
|
|
|
current_app.logger.info("Getting count of live services and organisations")
|
|
|
|
|
current_app.logger.info("Redis url from config is: {}".format(current_app.config['REDIS_URL']))
|
|
|
|
|
current_app.logger.info("Redis url from env is: {}".format( os.environ.get('REDIS_URL') ))
|
|
|
|
|
current_app.logger.info("Redis enabled from config is: {}".format(current_app.config['REDIS_ENABLED']))
|
|
|
|
|
current_app.logger.info("Redis enabled from env is: {}".format( os.environ.get('REDIS_ENABLED') ))
|
|
|
|
|
return self.get(url='/service')
|
|
|
|
|
|
2018-10-26 15:39:32 +01:00
|
|
|
|
|
|
|
|
status_api_client = StatusApiClient()
|