Automate counting of live services and orgs

Returns the data calculated by the API. Stored in Redis against a
hardcoded key so that no-one hammering the home page is directly hitting
the database.
This commit is contained in:
Chris Hill-Scott
2019-04-10 17:20:51 +01:00
parent 55eaa066f1
commit 9863aa3c48
10 changed files with 61 additions and 15 deletions

View File

@@ -12,7 +12,7 @@ from notifications_utils.international_billing_rates import (
)
from notifications_utils.template import HTMLEmailTemplate, LetterImageTemplate
from app import email_branding_client, letter_branding_client
from app import email_branding_client, letter_branding_client, status_api_client
from app.main import main
from app.main.forms import FieldWithNoneOption, SearchByNameForm
from app.main.views.sub_navigation_dictionaries import features_nav
@@ -21,9 +21,14 @@ from app.utils import AgreementInfo, get_logo_cdn_domain
@main.route('/')
def index():
if current_user and current_user.is_authenticated:
return redirect(url_for('main.choose_account'))
return render_template('views/signedout.html')
return render_template(
'views/signedout.html',
counts=status_api_client.get_count_of_live_services_and_organisations(),
)
@main.route('/robots.txt')