changeset 2299:e2dbdaf13562 beta

Don't clear dbsessions when celery_eager is turned on
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 17 May 2012 14:26:43 +0200
parents 4747af4ce203
children edfff9f37916 66fa6c434ce4
files docs/changelog.rst rhodecode/__init__.py rhodecode/config/environment.py rhodecode/lib/celerylib/__init__.py rhodecode/lib/celerylib/tasks.py
diffstat 5 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/docs/changelog.rst	Thu May 17 14:03:35 2012 +0200
+++ b/docs/changelog.rst	Thu May 17 14:26:43 2012 +0200
@@ -13,12 +13,14 @@
 news
 ++++
  
- - new codereview system
- - changed setup-app into setup-rhodecode and added default options to it.
+- new codereview system
+- changed setup-app into setup-rhodecode and added default options to it.
  
 fixes
 +++++
 
+
+
 1.3.6 (**2012-05-17**)
 ----------------------
 
@@ -36,6 +38,7 @@
 - fixed __future__ import error on rcextensions
 - made simplejson required lib for speedup on JSON encoding
 - fixes #449 bad regex could get more than revisions from parsing history
+- don't clear DB session when CELERY_EAGER is turned ON
 
 1.3.5 (**2012-05-10**)
 ----------------------
--- a/rhodecode/__init__.py	Thu May 17 14:03:35 2012 +0200
+++ b/rhodecode/__init__.py	Thu May 17 14:26:43 2012 +0200
@@ -89,6 +89,7 @@
 }
 
 CELERY_ON = False
+CELERY_EAGER = False
 
 # link to config for pylons
 CONFIG = {}
--- a/rhodecode/config/environment.py	Thu May 17 14:03:35 2012 +0200
+++ b/rhodecode/config/environment.py	Thu May 17 14:26:43 2012 +0200
@@ -47,6 +47,7 @@
 
     # store some globals into rhodecode
     rhodecode.CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
+    rhodecode.CELERY_EAGER = str2bool(config['app_conf'].get('celery.always.eager'))
 
     config['routes.map'] = make_map(config)
     config['pylons.app_globals'] = app_globals.Globals(config)
--- a/rhodecode/lib/celerylib/__init__.py	Thu May 17 14:03:35 2012 +0200
+++ b/rhodecode/lib/celerylib/__init__.py	Thu May 17 14:26:43 2012 +0200
@@ -35,7 +35,7 @@
 from decorator import decorator
 
 from rhodecode.lib.vcs.utils.lazy import LazyProperty
-from rhodecode import CELERY_ON
+from rhodecode import CELERY_ON, CELERY_EAGER
 from rhodecode.lib.utils2 import str2bool, safe_str
 from rhodecode.lib.pidlock import DaemonLock, LockHeld
 from rhodecode.model import init_model
@@ -122,7 +122,7 @@
             ret = func(*fargs, **fkwargs)
             return ret
         finally:
-            if CELERY_ON:
+            if CELERY_ON and CELERY_EAGER is False:
                 meta.Session.remove()
 
     return decorator(__wrapper, func)
--- a/rhodecode/lib/celerylib/tasks.py	Thu May 17 14:03:35 2012 +0200
+++ b/rhodecode/lib/celerylib/tasks.py	Thu May 17 14:26:43 2012 +0200
@@ -39,7 +39,7 @@
 
 from rhodecode.lib.vcs import get_backend
 
-from rhodecode import CELERY_ON
+from rhodecode import CELERY_ON, CELERY_EAGER
 from rhodecode.lib.utils2 import safe_str
 from rhodecode.lib.celerylib import run_task, locked_task, dbsession, \
     str2bool, __get_lockkey, LockHeld, DaemonLock, get_session