equal
deleted
inserted
replaced
144 raise |
144 raise |
145 self._threads_in_transaction.add(threading.currentThread()) |
145 self._threads_in_transaction.add(threading.currentThread()) |
146 return self._threaddata.pool |
146 return self._threaddata.pool |
147 |
147 |
148 def reset_pool(self): |
148 def reset_pool(self): |
149 """the session has no longer using its pool, at least for some time""" |
149 """the session is no longer using its pool, at least for some time""" |
150 # pool may be none if no operation has been done since last commit |
150 # pool may be none if no operation has been done since last commit |
151 # or rollback |
151 # or rollback |
152 if self.pool is not None and self.mode == 'read': |
152 if self.pool is not None and self.mode == 'read': |
153 # even in read mode, we must release the current transaction |
153 # even in read mode, we must release the current transaction |
154 pool = self.pool |
154 pool = self.pool |
155 self._threads_in_transaction.remove(threading.currentThread()) |
155 try: |
|
156 self._threads_in_transaction.remove(threading.currentThread()) |
|
157 except KeyError: |
|
158 pass |
156 pool.pool_reset() |
159 pool.pool_reset() |
157 self._threaddata.pool = None |
160 self._threaddata.pool = None |
158 # free pool once everything is done to avoid race-condition |
161 # free pool once everything is done to avoid race-condition |
159 self.repo._free_pool(pool) |
162 self.repo._free_pool(pool) |
160 |
163 |