aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2012-05-17 14:27:51 +0200
committerMarcin Kuzminski <marcin@python-works.com>2012-05-17 14:27:51 +0200
commit8f48452c6bfa06ed19fcb3038940d9b22921d25f (patch)
tree927ed67ee23a7880e1100b9db41b33aa8a9c284d
parenteca3ecd2f2660c3ed18284e7ef9dc3e4c4f8d333 (diff)
parent037619f131ef15eeabc098421ae855511c867fd2 (diff)
merge with betav1.3.6
-rwxr-xr-xdocs/changelog.rst1
-rw-r--r--rhodecode/__init__.py1
-rw-r--r--rhodecode/config/environment.py1
-rw-r--r--rhodecode/lib/celerylib/__init__.py4
-rw-r--r--rhodecode/lib/celerylib/tasks.py2
5 files changed, 6 insertions, 3 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index bfd3a98a..2af4ab9a 100755
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -21,6 +21,7 @@ fixes
- 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**)
----------------------
diff --git a/rhodecode/__init__.py b/rhodecode/__init__.py
index 5cff8c12..209c0b39 100644
--- a/rhodecode/__init__.py
+++ b/rhodecode/__init__.py
@@ -89,6 +89,7 @@ BACKENDS = {
}
CELERY_ON = False
+CELERY_EAGER = False
# link to config for pylons
CONFIG = {}
diff --git a/rhodecode/config/environment.py b/rhodecode/config/environment.py
index 470a92f5..fb85005d 100644
--- a/rhodecode/config/environment.py
+++ b/rhodecode/config/environment.py
@@ -47,6 +47,7 @@ def load_environment(global_conf, app_conf, initial=False):
# 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)
diff --git a/rhodecode/lib/celerylib/__init__.py b/rhodecode/lib/celerylib/__init__.py
index 926f2bf5..7f2f4074 100644
--- a/rhodecode/lib/celerylib/__init__.py
+++ b/rhodecode/lib/celerylib/__init__.py
@@ -35,7 +35,7 @@ from hashlib import md5
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 @@ def dbsession(func):
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)
diff --git a/rhodecode/lib/celerylib/tasks.py b/rhodecode/lib/celerylib/tasks.py
index dfae792d..5d25ffe7 100644
--- a/rhodecode/lib/celerylib/tasks.py
+++ b/rhodecode/lib/celerylib/tasks.py
@@ -39,7 +39,7 @@ from pylons.i18n.translation import _
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