mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-08 17:38:43 +00:00
[Stats] Remove blanket try..excepts and stop timers correctly
This commit is contained in:
parent
676574ff19
commit
d09df063a5
1 changed files with 51 additions and 63 deletions
|
@ -97,12 +97,9 @@ class Core(CorePluginBase):
|
||||||
self.save_timer.start(60)
|
self.save_timer.start(60)
|
||||||
|
|
||||||
def disable(self):
|
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()
|
self.save_stats()
|
||||||
try:
|
|
||||||
self.update_timer.stop()
|
|
||||||
self.save_timer.stop()
|
|
||||||
except AssertionError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def add_stats(self, *stats):
|
def add_stats(self, *stats):
|
||||||
for stat in stats:
|
for stat in stats:
|
||||||
|
@ -113,7 +110,6 @@ class Core(CorePluginBase):
|
||||||
self.stats[i][stat] = []
|
self.stats[i][stat] = []
|
||||||
|
|
||||||
def update_stats(self):
|
def update_stats(self):
|
||||||
try:
|
|
||||||
# Get all possible stats!
|
# Get all possible stats!
|
||||||
stats = {}
|
stats = {}
|
||||||
for key in self.stats_keys:
|
for key in self.stats_keys:
|
||||||
|
@ -165,18 +161,10 @@ class Core(CorePluginBase):
|
||||||
update_interval(30, 5, 6)
|
update_interval(30, 5, 6)
|
||||||
update_interval(300, 30, 10)
|
update_interval(300, 30, 10)
|
||||||
|
|
||||||
except Exception as ex:
|
|
||||||
log.error('Stats update error %s', ex)
|
|
||||||
return True
|
|
||||||
|
|
||||||
def save_stats(self):
|
def save_stats(self):
|
||||||
try:
|
|
||||||
self.saved_stats['stats'] = self.stats
|
self.saved_stats['stats'] = self.stats
|
||||||
self.saved_stats.config.update(self.get_totals())
|
self.saved_stats.config.update(self.get_totals())
|
||||||
self.saved_stats.save()
|
self.saved_stats.save()
|
||||||
except Exception as ex:
|
|
||||||
log.error('Stats save error %s', ex)
|
|
||||||
return True
|
|
||||||
|
|
||||||
# export:
|
# export:
|
||||||
@export
|
@export
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue