Skip to content

Commit

Permalink
Merge pull request #803 from uktrade/develop
Browse files Browse the repository at this point in the history
Staging release
  • Loading branch information
sdonk authored Mar 6, 2020
2 parents 183f3e4 + d7f0210 commit 567f34c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -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
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
3 changes: 2 additions & 1 deletion conf/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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()
2 changes: 1 addition & 1 deletion core/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion tests/core/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 567f34c

Please sign in to comment.