Skip to content

Commit e5a00c0

Browse files
committed
https://gitcoincore.slack.com/archives/CJWQWG6J2/p1606747303001200
1 parent 7c0d392 commit e5a00c0

1 file changed

Lines changed: 26 additions & 17 deletions

File tree

app/perftools/management/commands/create_page_cache.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
'''
1818

1919
import json
20+
import logging
2021

2122
from django.conf import settings
2223
from django.core.management.base import BaseCommand
@@ -46,6 +47,7 @@
4647
from retail.views import get_contributor_landing_page_context, get_specific_activities
4748
from townsquare.views import tags
4849

50+
logger = logging.getLogger(__name__)
4951

5052
def create_email_inventory_cache():
5153
print('create_email_inventory_cache')
@@ -384,24 +386,31 @@ class Command(BaseCommand):
384386
help = 'generates some /results data'
385387

386388
def handle(self, *args, **options):
387-
create_grant_type_cache()
388-
create_grant_clr_cache()
389-
create_grant_category_size_cache()
390-
create_grant_active_clr_mapping()
389+
operations = []
390+
operations.append(create_grant_type_cache)
391+
operations.append(create_grant_clr_cache)
392+
operations.append(create_grant_category_size_cache)
393+
operations.append(create_grant_active_clr_mapping)
391394
if not settings.DEBUG:
392-
create_results_cache()
393-
create_hidden_profiles_cache()
394-
create_tribes_cache()
395-
create_activity_cache()
396-
create_post_cache()
397-
create_top_grant_spenders_cache()
398-
create_avatar_cache()
399-
create_quests_cache()
400-
create_grants_cache()
401-
create_contributor_landing_page_context()
402-
create_hackathon_cache()
403-
create_hackathon_list_page_cache()
395+
operations.append(create_results_cache)
396+
operations.append(create_hidden_profiles_cache)
397+
operations.append(create_tribes_cache)
398+
operations.append(create_activity_cache)
399+
operations.append(create_post_cache)
400+
operations.append(create_top_grant_spenders_cache)
401+
operations.append(create_avatar_cache)
402+
operations.append(create_quests_cache)
403+
operations.append(create_grants_cache)
404+
operations.append(create_contributor_landing_page_context)
405+
operations.append(create_hackathon_cache)
406+
operations.append(create_hackathon_list_page_cache)
404407
hour = int(timezone.now().strftime('%H'))
405408
if hour < 4:
406409
# do dailyi updates
407-
create_email_inventory_cache()
410+
operations.append(create_email_inventory_cache)
411+
for func in operations:
412+
try:
413+
print(f'running {func}')
414+
func()
415+
except Exception as e:
416+
logger.exception(e)

0 commit comments

Comments
 (0)