annotate custom_search/tasks.py @ 791:0ca691cccf8d

Utilize select_related() for user & user profiles. This commit also removes the caching of the avatar URL in the avatar template tag. This is because we are now using select_related, so we already have the profile & avatar when we get to the tag. Thus we don't need to waste time querying the cache. Removed an apparently unused member map template as well.
author Brian Neal <bgneal@gmail.com>
date Fri, 23 May 2014 21:52:41 -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")