411 self.close_sessions() |
411 self.close_sessions() |
412 while not self._cnxsets_pool.empty(): |
412 while not self._cnxsets_pool.empty(): |
413 cnxset = self._cnxsets_pool.get_nowait() |
413 cnxset = self._cnxsets_pool.get_nowait() |
414 try: |
414 try: |
415 cnxset.close(True) |
415 cnxset.close(True) |
416 except: |
416 except Exception: |
417 self.exception('error while closing %s' % cnxset) |
417 self.exception('error while closing %s' % cnxset) |
418 continue |
418 continue |
419 if self.pyro_registered: |
419 if self.pyro_registered: |
420 if self._use_pyrons(): |
420 if self._use_pyrons(): |
421 pyro_unregister(self.config) |
421 pyro_unregister(self.config) |
789 session = self._get_session(sessionid) |
789 session = self._get_session(sessionid) |
790 session.set_tx_data(txid) |
790 session.set_tx_data(txid) |
791 return session.commit() |
791 return session.commit() |
792 except (ValidationError, Unauthorized): |
792 except (ValidationError, Unauthorized): |
793 raise |
793 raise |
794 except: |
794 except Exception: |
795 self.exception('unexpected error') |
795 self.exception('unexpected error') |
796 raise |
796 raise |
797 |
797 |
798 def rollback(self, sessionid, txid=None): |
798 def rollback(self, sessionid, txid=None): |
799 """commit transaction for the session with the given id""" |
799 """commit transaction for the session with the given id""" |
800 self.debug('begin rollback for session %s', sessionid) |
800 self.debug('begin rollback for session %s', sessionid) |
801 try: |
801 try: |
802 session = self._get_session(sessionid) |
802 session = self._get_session(sessionid) |
803 session.set_tx_data(txid) |
803 session.set_tx_data(txid) |
804 session.rollback() |
804 session.rollback() |
805 except: |
805 except Exception: |
806 self.exception('unexpected error') |
806 self.exception('unexpected error') |
807 raise |
807 raise |
808 |
808 |
809 def close(self, sessionid, txid=None, checkshuttingdown=True): |
809 def close(self, sessionid, txid=None, checkshuttingdown=True): |
810 """close the session with the given id""" |
810 """close the session with the given id""" |
903 def close_sessions(self): |
903 def close_sessions(self): |
904 """close every opened sessions""" |
904 """close every opened sessions""" |
905 for sessionid in self._sessions.keys(): |
905 for sessionid in self._sessions.keys(): |
906 try: |
906 try: |
907 self.close(sessionid, checkshuttingdown=False) |
907 self.close(sessionid, checkshuttingdown=False) |
908 except: |
908 except Exception: # XXX BaseException? |
909 self.exception('error while closing session %s' % sessionid) |
909 self.exception('error while closing session %s' % sessionid) |
910 |
910 |
911 def clean_sessions(self): |
911 def clean_sessions(self): |
912 """close sessions not used since an amount of time specified in the |
912 """close sessions not used since an amount of time specified in the |
913 configuration |
913 configuration |