Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Bug 1110231 - Improve render_stale_docs Celery task.
Browse files Browse the repository at this point in the history
This sets the always-eager-mode on Travis, too.
Making the render_stale_documents task a in-process-thing.
  • Loading branch information
jezdez committed Jan 8, 2015
1 parent bbb2ab0 commit 2e0bece
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
12 changes: 2 additions & 10 deletions kuma/wiki/tasks.py
Expand Up @@ -11,7 +11,6 @@
from django.core.cache import get_cache

from constance import config
import waffle

from devmo.utils import MemcacheLock
from .exceptions import StaleDocumentsRenderingInProgress, PageMoveError
Expand Down Expand Up @@ -63,15 +62,8 @@ def render_stale_documents(immediate=False, log=None):
settings.SITE_URL))
subtasks.append(subtask)
log.info("Deferred rendering for stale %s" % doc)
if subtasks:
task_group = group(tasks=subtasks)
if waffle.switch_is_active('render_stale_documents_async'):
# kick off the task group asynchronously
task_group.apply_async()
else:
# kick off the task group synchronously
result = task_group.apply()
response = result.join()
task_group = group(subtasks)
task_group().get() # calling it since async doesn't work
finally:
lock.release()
return response
Expand Down
1 change: 1 addition & 0 deletions settings_travis.py
@@ -1,5 +1,6 @@
from settings import *

CELERY_ALWAYS_EAGER = True
ASYNC_SIGNALS = False
ES_URLS = ['http://localhost:9200']
ES_INDEX_PREFIX = 'mdn'
Expand Down

0 comments on commit 2e0bece

Please sign in to comment.