diff --git a/indico/MaKaC/common/db.py b/indico/MaKaC/common/db.py
index 00dc3dd..af0ebad 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 threading._get_ident() |
| | 98 | |
| 95 | 99 | def _getConnObject(self): |
| 96 | | tid=threading._get_ident() |
| 97 | | if self._conn.has_key(tid): |
| 98 | | return self._conn[tid] |
| 99 | | return None |
| | 100 | tid = DBMgr._getUniqueIdentifier() |
| | 101 | return self._conn[tid] |
| 100 | 102 | |
| 101 | 103 | def _delConnObject(self): |
| 102 | | tid=threading._get_ident() |
| | 104 | tid = DBMgr._getUniqueIdentifier() |
| 103 | 105 | del self._conn[tid] |
| 104 | 106 | |
| 105 | 107 | def startRequest( self ): |
| 106 | 108 | """Initialise the DB and starts a new transaction. |
| 107 | 109 | """ |
| 108 | 110 | |
| 109 | | conn = self._getConnObject() |
| 110 | | 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))) |
| 113 | | else: |
| 114 | | Logger.get('dbmgr').debug('Reused connection for thread %s - table size is %s' % (threading._get_ident(), len(self._conn))) |
| | 111 | tid = DBMgr._getUniqueIdentifier() |
| | 112 | |
| | 113 | self._conn[tid] = self._db.open() |
| | 114 | Logger.get('dbmgr').debug('Allocated connection for %s - table size is %s' % (tid, len(self._conn))) |
| 115 | 115 | |
| 116 | 116 | def endRequest( self, commit=True ): |
| 117 | 117 | """Closes the DB and commits changes. |