Fix an issue with settings being saved too early
This commit is contained in:
1 parent
3bccbc45c3
commit
2f452ca045
2 files changed
+6
-3
No files matched your search
@@ -177,6 +177,10 @@ if not client.gui.close_requested:
|
||||
"\nApplication Terminated.\nClose the window to exit the application."
|
||||
)
|
||||
loop.run_until_complete(client.gui.wait_until_closed())
|
||||
# save settings
|
||||
# NOTE: we have to do it after wait_until_closed,
|
||||
# because the user can alter settings between shutdown and closing the window
|
||||
client.settings.save()
|
||||
client.gui.stop()
|
||||
client.gui.close_window()
|
||||
loop.run_until_complete(loop.shutdown_asyncgens())
|
||||
|
||||
@@ -102,9 +102,8 @@ class Twitch:
|
||||
session, self._session = self._session, None
|
||||
await session.close()
|
||||
await self.websocket.stop()
|
||||
# save other important files
|
||||
self.settings.save() # settings
|
||||
self.gui.save() # image cache
|
||||
# save image cache
|
||||
self.gui.save()
|
||||
# wait at least half a second + whatever it takes to complete the closing
|
||||
# this allows aiohttp to safely close the session
|
||||
await asyncio.sleep(start_time + 0.5 - time())
|
||||
|
||||
Reference in new issue
Block a user