def on_close(self): try: ChatSocketHandler.waiters.remove(self) except KeyError: pass if not database.is_closed(): database.close()
def close(self): if not database.is_closed(): database.close() try: ChatSocketHandler.waiters.remove(self) except KeyError: pass super().close()
def on_finish(self): if not database.is_closed(): database.close() return super().on_finish()
def prepare(self): self.xsrf_token if not database.is_closed(): database.close() database.connect() return super().prepare()