annotate custom_search/tasks.py @ 953:8647a669edb4

Fix excessive cache usage for forum date/times. Issue #84. Hitting the cache 30+ times while browsing the forums to adjust all the dates/times into the user's time zone. Just hit the user's profile and be done with it. It should be loaded.
author Brian Neal <bgneal@gmail.com>
date Tue, 19 May 2015 21:08:45 -0500
parents f97dd33ca52d
children
rev   line source
bgneal@525 1 """
bgneal@525 2 Tasks for our custom search application.
bgneal@525 3
bgneal@525 4 """
bgneal@750 5 from __future__ import absolute_import
bgneal@750 6
bgneal@750 7 from celery import shared_task
bgneal@755 8 from celery.utils.log import get_task_logger
bgneal@726 9 from django.conf import settings
bgneal@525 10
bgneal@525 11 from queued_search.management.commands.process_search_queue import Command
bgneal@525 12
bgneal@755 13 logger = get_task_logger(__name__)
bgneal@755 14
bgneal@525 15
bgneal@750 16 @shared_task
bgneal@525 17 def process_search_queue_task():
bgneal@525 18 """
bgneal@525 19 Celery task to run the queued_search application's process_search_queue
bgneal@525 20 command.
bgneal@525 21
bgneal@525 22 """
bgneal@726 23 if settings.SEARCH_QUEUE_ENABLED:
bgneal@726 24 command = Command()
bgneal@726 25 command.execute()
bgneal@726 26 else:
bgneal@726 27 logger.warning("Search queue disabled; skipping processing")