--- a/server/repository.py Mon Feb 27 13:00:36 2012 +0100
+++ b/server/repository.py Mon Feb 27 18:15:23 2012 +0100
@@ -887,9 +887,12 @@
and :class:`cubicweb.server.Service`
"""
def task():
- session = self._get_session(sessionid)
+ session = self._get_session(sessionid, setcnxset=True)
service = session.vreg['services'].select(regid, session, **kwargs)
- return service.call(session, **kwargs)
+ try:
+ return service.call(session, **kwargs)
+ finally:
+ session.rollback() # free cnxset
if async:
self.info('calling service %s asynchronously', regid)
self.threaded_task(task)