Commit to DB before shutdown

Because some operations use the _timeout_commit() it happens that a timeout
is active while we shutdown.

This makes sure everything is commited before shutdown.
This commit is contained in:
Philipp Hörist 2017-07-10 16:25:26 +02:00
parent 0eca29d484
commit 5a8965791c
2 changed files with 5 additions and 2 deletions

View File

@ -168,7 +168,7 @@ class Logger:
self.open_db()
self.get_jids_already_in_db()
def _really_commit(self):
def commit(self):
try:
self.con.commit()
except sqlite.OperationalError as e:
@ -179,7 +179,7 @@ class Logger:
def _timeout_commit(self):
if self.commit_timout_id:
return
self.commit_timout_id = GLib.timeout_add(500, self._really_commit)
self.commit_timout_id = GLib.timeout_add(500, self.commit)
def simple_commit(self, sql_to_commit):
"""

View File

@ -2469,6 +2469,9 @@ class RosterWindow:
gajim.interface.hide_systray()
self.save_done = True
# Commit any outstanding SQL transactions
gajim.logger.commit()
def quit_gtkgui_interface(self):
"""
When we quit the gtk interface - exit gtk