Skip to content

Commit

Permalink
https://gitcoincore.slack.com/archives/CJWQWG6J2/p1606747303001200
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed Nov 30, 2020
1 parent 7c0d392 commit e5a00c0
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions app/perftools/management/commands/create_page_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'''

import json
import logging

from django.conf import settings
from django.core.management.base import BaseCommand
Expand Down Expand Up @@ -46,6 +47,7 @@
from retail.views import get_contributor_landing_page_context, get_specific_activities
from townsquare.views import tags

logger = logging.getLogger(__name__)

def create_email_inventory_cache():
print('create_email_inventory_cache')
Expand Down Expand Up @@ -384,24 +386,31 @@ class Command(BaseCommand):
help = 'generates some /results data'

def handle(self, *args, **options):
create_grant_type_cache()
create_grant_clr_cache()
create_grant_category_size_cache()
create_grant_active_clr_mapping()
operations = []
operations.append(create_grant_type_cache)
operations.append(create_grant_clr_cache)
operations.append(create_grant_category_size_cache)
operations.append(create_grant_active_clr_mapping)
if not settings.DEBUG:
create_results_cache()
create_hidden_profiles_cache()
create_tribes_cache()
create_activity_cache()
create_post_cache()
create_top_grant_spenders_cache()
create_avatar_cache()
create_quests_cache()
create_grants_cache()
create_contributor_landing_page_context()
create_hackathon_cache()
create_hackathon_list_page_cache()
operations.append(create_results_cache)
operations.append(create_hidden_profiles_cache)
operations.append(create_tribes_cache)
operations.append(create_activity_cache)
operations.append(create_post_cache)
operations.append(create_top_grant_spenders_cache)
operations.append(create_avatar_cache)
operations.append(create_quests_cache)
operations.append(create_grants_cache)
operations.append(create_contributor_landing_page_context)
operations.append(create_hackathon_cache)
operations.append(create_hackathon_list_page_cache)
hour = int(timezone.now().strftime('%H'))
if hour < 4:
# do dailyi updates
create_email_inventory_cache()
operations.append(create_email_inventory_cache)
for func in operations:
try:
print(f'running {func}')
func()
except Exception as e:
logger.exception(e)

0 comments on commit e5a00c0

Please sign in to comment.