mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 17:08:42 +00:00
Remove gobject timer and replace with a twisted LoopingCall
This commit is contained in:
parent
901038b3c2
commit
0ab8fa4871
1 changed files with 7 additions and 7 deletions
|
@ -22,10 +22,9 @@
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
import gobject
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
|
||||||
|
from twisted.internet.task import LoopingCall
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
|
@ -37,8 +36,9 @@ class _ConfigManager:
|
||||||
self.config_files = {}
|
self.config_files = {}
|
||||||
self.__config_directory = None
|
self.__config_directory = None
|
||||||
# Set a 5 minute timer to call save()
|
# Set a 5 minute timer to call save()
|
||||||
gobject.timeout_add(300000, self.save)
|
self.__timer = LoopingCall(self.save)
|
||||||
|
self.__timer.start(300, False)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def config_directory(self):
|
def config_directory(self):
|
||||||
if self.__config_directory is None:
|
if self.__config_directory is None:
|
||||||
|
@ -75,8 +75,8 @@ class _ConfigManager:
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
"""Saves all the configs to disk."""
|
"""Saves all the configs to disk."""
|
||||||
for key in self.config_files.keys():
|
for value in self.config_files.values():
|
||||||
self.config_files[key].save()
|
value.save()
|
||||||
# We need to return True to keep the timer active
|
# We need to return True to keep the timer active
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue