Mercurial > public > sg101
changeset 726:f0b997651497
For #54, provide a flag to skip search queue processing.
This is useful when we are rebuilding the index.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 22 Sep 2013 12:00:46 -0500 |
parents | 682b159f3763 |
children | c84759350725 |
files | custom_search/tasks.py sg101/settings/base.py |
diffstat | 2 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/custom_search/tasks.py Sat Sep 21 21:18:40 2013 -0500 +++ b/custom_search/tasks.py Sun Sep 22 12:00:46 2013 -0500 @@ -2,6 +2,7 @@ Tasks for our custom search application. """ +from django.conf import settings from celery.task import task from queued_search.management.commands.process_search_queue import Command @@ -14,5 +15,9 @@ command. """ - command = Command() - command.execute() + if settings.SEARCH_QUEUE_ENABLED: + command = Command() + command.execute() + else: + logger = process_search_queue_task.get_logger() + logger.warning("Search queue disabled; skipping processing")
--- a/sg101/settings/base.py Sat Sep 21 21:18:40 2013 -0500 +++ b/sg101/settings/base.py Sun Sep 22 12:00:46 2013 -0500 @@ -301,6 +301,10 @@ USER_PHOTOS_THUMB_SIZE = (120, 120) USER_PHOTOS_RATE_LIMIT = (50, 86400) # number / seconds +# If this flag is False, the queued_search queue will not be processed. This is +# useful when we are rebuilding the search index. +SEARCH_QUEUE_ENABLED = True + ####################################################################### # Asynchronous settings (queues, queued_search, redis, celery, etc) #######################################################################