mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 08:25:35 +00:00
stats: fix service issues
having moved inititalisation into startService to handle tub init cleanly, I neglected the up-call to startService, which wound up not starting the load_monitor. also I changed the 'running' attribute to 'started' since 'running' is the name used internally by MultiService itself.
This commit is contained in:
parent
3641b7924b
commit
f5a803303f
@ -26,21 +26,21 @@ class LoadMonitor(service.MultiService):
|
||||
service.MultiService.__init__(self)
|
||||
self.provider = provider
|
||||
self.warn_if_delay_exceeds = warn_if_delay_exceeds
|
||||
self.running = False
|
||||
self.started = False
|
||||
self.last = None
|
||||
self.stats = deque()
|
||||
|
||||
def startService(self):
|
||||
if not self.running:
|
||||
self.running = True
|
||||
if not self.started:
|
||||
self.started = True
|
||||
reactor.callLater(self.loop_interval, self.loop)
|
||||
service.MultiService.startService(self)
|
||||
|
||||
def stopService(self):
|
||||
self.running = False
|
||||
self.started = False
|
||||
|
||||
def loop(self):
|
||||
if not self.running:
|
||||
if not self.started:
|
||||
return
|
||||
now = time.time()
|
||||
if self.last is not None:
|
||||
@ -86,6 +86,7 @@ class StatsProvider(foolscap.Referenceable, service.MultiService):
|
||||
nickname = self.node.get_config('nickname')
|
||||
self.node.tub.connectTo(self.gatherer_furl, self._connected, nickname)
|
||||
d.addCallback(connect)
|
||||
service.MultiService.startService(self)
|
||||
|
||||
def count(self, name, delta):
|
||||
val = self.counters.setdefault(name, 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user