Remove gobject timer and replace with a twisted LoopingCall
This commit is contained in:
parent
901038b3c2
commit
0ab8fa4871
@ -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,7 +36,8 @@ 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):
|
||||||
@ -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…
x
Reference in New Issue
Block a user