From 7e226b050149bab705cc5761259a354734658d5a Mon Sep 17 00:00:00 2001 From: Alessandro Date: Thu, 5 Mar 2020 14:54:10 +0000 Subject: [PATCH 1/3] exclude wagtail core page from cache --- core/cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/cache.py b/core/cache.py index fe798bc4..83ff74a5 100644 --- a/core/cache.py +++ b/core/cache.py @@ -288,5 +288,5 @@ def delete(cls, sender, instance, *args, **kwargs): @app.task def rebuild_all_cache(): for page in Page.objects.live().specific(): - if page.__class__ in MODELS_SERIALIZERS_MAPPING: + if page.__class__ in MODELS_SERIALIZERS_MAPPING and page.__class__ is not Page: CachePopulator.populate_async(page) From 7eed82541daf0ef7b0c8af6235eae5a0e2d36d7b Mon Sep 17 00:00:00 2001 From: Alessandro Date: Thu, 5 Mar 2020 15:34:36 +0000 Subject: [PATCH 2/3] fix tests --- tests/core/test_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/test_cache.py b/tests/core/test_cache.py index bd24dd3f..2d29e143 100644 --- a/tests/core/test_cache.py +++ b/tests/core/test_cache.py @@ -235,6 +235,6 @@ def test_rebuild_all_cache_task(mock_cache_populator): article2 = InternationalArticlePageFactory(live=True) InternationalArticlePageFactory(live=False) cache.rebuild_all_cache() - assert mock_cache_populator.populate_async.call_count == 5 # contains root, welcome to wagtail and home pages + assert mock_cache_populator.populate_async.call_count == 3 # contains home page assert mock_cache_populator.populate_async.call_args_list[-2] == call(article1) assert mock_cache_populator.populate_async.call_args_list[-1] == call(article2) From c54fddbbcf513baf74af60dfbacdc826e6570e9c Mon Sep 17 00:00:00 2001 From: richtier Date: Thu, 5 Mar 2020 16:10:38 +0000 Subject: [PATCH 3/3] Turn off staff sso in celery mode --- Procfile | 4 ++-- conf/celery.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Procfile b/Procfile index 6388f7ce..0c7bd5d4 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ web: python manage.py distributed_migrate --noinput && gunicorn conf.wsgi --bind 0.0.0.0:$PORT -celery_worker: celery -A conf worker -l info -celery_beat: celery -A conf beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler \ No newline at end of file +celery_worker: FEATURE_ENFORCE_STAFF_SSO_ENABLED=False celery -A conf worker -l info +celery_beat: FEATURE_ENFORCE_STAFF_SSO_ENABLED=False celery -A conf beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler \ No newline at end of file diff --git a/conf/celery.py b/conf/celery.py index cf7a19d0..6b1522b9 100644 --- a/conf/celery.py +++ b/conf/celery.py @@ -6,6 +6,8 @@ from celery import Celery +# note AUTHBROKER_URL is misidentified as a secret by celery when pidbox is used, resulting in +# celery trying to parse AUTHBROKER_URL as a transport, resulting in error. so turn the feature off in Procfile # set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'conf.settings') @@ -28,6 +30,5 @@ app.conf.broker_use_ssl = ssl_conf app.conf.redis_backend_use_ssl = ssl_conf - # Load task modules from all registered Django app configs. app.autodiscover_tasks()