Refactor exit-offline code

This commit is contained in:
miruka
2020-07-16 23:34:35 -04:00
parent f316a24550
commit 4784c80ed9
3 changed files with 22 additions and 17 deletions

View File

@@ -146,14 +146,10 @@ class QMLBridge:
remote_pdb.RemotePdb("127.0.0.1", 4444).set_trace()
def exit_mirage(self) -> None:
"""Used to end some tasks before closing"""
def exit(self) -> None:
try:
# Set accounts presence to offline
asyncio.run_coroutine_threadsafe(
self.backend.logoff_all(),
self._loop,
self.backend.terminate_clients(), self._loop,
).result()
except Exception as e:
print(e)
@@ -179,4 +175,4 @@ except ValueError:
BRIDGE = QMLBridge()
pyotherside.atexit(BRIDGE.exit_mirage)
pyotherside.atexit(BRIDGE.exit)