comparison rhodecode/lib/celerylib/__init__.py @ 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 8ecfed1d8f8b
children edfff9f37916 9d4b80743a2a
comparison
equal deleted inserted replaced
2297:4747af4ce203 2299:e2dbdaf13562
33 33
34 from hashlib import md5 34 from hashlib import md5
35 from decorator import decorator 35 from decorator import decorator
36 36
37 from rhodecode.lib.vcs.utils.lazy import LazyProperty 37 from rhodecode.lib.vcs.utils.lazy import LazyProperty
38 from rhodecode import CELERY_ON 38 from rhodecode import CELERY_ON, CELERY_EAGER
39 from rhodecode.lib.utils2 import str2bool, safe_str 39 from rhodecode.lib.utils2 import str2bool, safe_str
40 from rhodecode.lib.pidlock import DaemonLock, LockHeld 40 from rhodecode.lib.pidlock import DaemonLock, LockHeld
41 from rhodecode.model import init_model 41 from rhodecode.model import init_model
42 from rhodecode.model import meta 42 from rhodecode.model import meta
43 from rhodecode.model.db import Statistics, Repository, User 43 from rhodecode.model.db import Statistics, Repository, User
120 def __wrapper(func, *fargs, **fkwargs): 120 def __wrapper(func, *fargs, **fkwargs):
121 try: 121 try:
122 ret = func(*fargs, **fkwargs) 122 ret = func(*fargs, **fkwargs)
123 return ret 123 return ret
124 finally: 124 finally:
125 if CELERY_ON: 125 if CELERY_ON and CELERY_EAGER is False:
126 meta.Session.remove() 126 meta.Session.remove()
127 127
128 return decorator(__wrapper, func) 128 return decorator(__wrapper, func)