# HG changeset patch # User Mads Kiilerich # Date 2013-03-05 16:09:46 # Node ID 27525c5fbc36da3f828eec3e31b081657703a784 # Parent 94f251fda314627cdc51a20018ad2319ff75add0 fix SyntaxWarning: name 'CELERY_ON' is used prior to global declaration diff --git a/rhodecode/lib/celerylib/__init__.py b/rhodecode/lib/celerylib/__init__.py --- a/rhodecode/lib/celerylib/__init__.py +++ b/rhodecode/lib/celerylib/__init__.py @@ -59,6 +59,7 @@ class ResultWrapper(object): def run_task(task, *args, **kwargs): + global CELERY_ON if CELERY_ON: try: t = task.apply_async(args=args, kwargs=kwargs) @@ -68,7 +69,6 @@ def run_task(task, *args, **kwargs): except socket.error, e: if isinstance(e, IOError) and e.errno == 111: log.debug('Unable to connect to celeryd. Sync execution') - global CELERY_ON CELERY_ON = False else: log.error(traceback.format_exc())