diff --git a/indico/MaKaC/common/db.py b/indico/MaKaC/common/db.py
index 00dc3dd..7729bfb 100644
|
a
|
b
|
class DBMgr: |
| 92 | 92 | cls._instance=DBMgr(*args, **kwargs) |
| 93 | 93 | return cls._instance |
| 94 | 94 | |
| | 95 | @staticmethod |
| | 96 | def _getUniqueIdentifier(): |
| | 97 | return "%s.%s" % (os.getpid(), threading._get_ident()) |
| | 98 | |
| 95 | 99 | def _getConnObject(self): |
| 96 | | tid=threading._get_ident() |
| | 100 | tid = DBMgr._getUniqueIdentifier() |
| 97 | 101 | if self._conn.has_key(tid): |
| 98 | 102 | return self._conn[tid] |
| 99 | 103 | return None |
| 100 | 104 | |
| 101 | 105 | def _delConnObject(self): |
| 102 | | tid=threading._get_ident() |
| | 106 | tid = DBMgr._getUniqueIdentifier() |
| 103 | 107 | del self._conn[tid] |
| 104 | 108 | |
| 105 | 109 | def startRequest( self ): |
| 106 | 110 | """Initialise the DB and starts a new transaction. |
| 107 | 111 | """ |
| 108 | 112 | |
| | 113 | tid = DBMgr._getUniqueIdentifier() |
| 109 | 114 | conn = self._getConnObject() |
| 110 | 115 | if conn is None: |
| 111 | | self._conn[threading._get_ident()]=self._db.open() |
| 112 | | Logger.get('dbmgr').debug('Allocated connection for thread %s - table size is %s' % (threading._get_ident(), len(self._conn))) |
| | 116 | self._conn[tid] = self._db.open() |
| | 117 | Logger.get('dbmgr').debug('Allocated connection for thread %s - table size is %s' % (tid, len(self._conn))) |
| 113 | 118 | else: |
| 114 | | Logger.get('dbmgr').debug('Reused connection for thread %s - table size is %s' % (threading._get_ident(), len(self._conn))) |
| | 119 | Logger.get('dbmgr').debug('Reused connection for thread %s - table size is %s' % (tid, len(self._conn))) |
| 115 | 120 | |
| 116 | 121 | def endRequest( self, commit=True ): |
| 117 | 122 | """Closes the DB and commits changes. |