mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 12:34:43 +00:00
[Stats] Remove blanket try..excepts and stop timers correctly
This commit is contained in:
parent
676574ff19
commit
d09df063a5
@ -97,12 +97,9 @@ class Core(CorePluginBase):
|
||||
self.save_timer.start(60)
|
||||
|
||||
def disable(self):
|
||||
self.update_timer.stop() if self.update_timer.running else None
|
||||
self.save_timer.stop() if self.save_timer.running else None
|
||||
self.save_stats()
|
||||
try:
|
||||
self.update_timer.stop()
|
||||
self.save_timer.stop()
|
||||
except AssertionError:
|
||||
pass
|
||||
|
||||
def add_stats(self, *stats):
|
||||
for stat in stats:
|
||||
@ -113,7 +110,6 @@ class Core(CorePluginBase):
|
||||
self.stats[i][stat] = []
|
||||
|
||||
def update_stats(self):
|
||||
try:
|
||||
# Get all possible stats!
|
||||
stats = {}
|
||||
for key in self.stats_keys:
|
||||
@ -165,18 +161,10 @@ class Core(CorePluginBase):
|
||||
update_interval(30, 5, 6)
|
||||
update_interval(300, 30, 10)
|
||||
|
||||
except Exception as ex:
|
||||
log.error('Stats update error %s', ex)
|
||||
return True
|
||||
|
||||
def save_stats(self):
|
||||
try:
|
||||
self.saved_stats['stats'] = self.stats
|
||||
self.saved_stats.config.update(self.get_totals())
|
||||
self.saved_stats.save()
|
||||
except Exception as ex:
|
||||
log.error('Stats save error %s', ex)
|
||||
return True
|
||||
|
||||
# export:
|
||||
@export
|
||||
|
Loading…
x
Reference in New Issue
Block a user