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:
parent
0eca29d484
commit
5a8965791c
2 changed files with 5 additions and 2 deletions
|
@ -168,7 +168,7 @@ class Logger:
|
||||||
self.open_db()
|
self.open_db()
|
||||||
self.get_jids_already_in_db()
|
self.get_jids_already_in_db()
|
||||||
|
|
||||||
def _really_commit(self):
|
def commit(self):
|
||||||
try:
|
try:
|
||||||
self.con.commit()
|
self.con.commit()
|
||||||
except sqlite.OperationalError as e:
|
except sqlite.OperationalError as e:
|
||||||
|
@ -179,7 +179,7 @@ class Logger:
|
||||||
def _timeout_commit(self):
|
def _timeout_commit(self):
|
||||||
if self.commit_timout_id:
|
if self.commit_timout_id:
|
||||||
return
|
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):
|
def simple_commit(self, sql_to_commit):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -2469,6 +2469,9 @@ class RosterWindow:
|
||||||
gajim.interface.hide_systray()
|
gajim.interface.hide_systray()
|
||||||
self.save_done = True
|
self.save_done = True
|
||||||
|
|
||||||
|
# Commit any outstanding SQL transactions
|
||||||
|
gajim.logger.commit()
|
||||||
|
|
||||||
def quit_gtkgui_interface(self):
|
def quit_gtkgui_interface(self):
|
||||||
"""
|
"""
|
||||||
When we quit the gtk interface - exit gtk
|
When we quit the gtk interface - exit gtk
|
||||||
|
|
Loading…
Add table
Reference in a new issue