...except that tally should require the lock.

This commit is contained in:
James Muscat 2015-04-13 18:28:50 +01:00
parent 4bab5e3606
commit 384a4f40fe

View File

@ -51,10 +51,11 @@ class StatsCollector(Thread):
self.outboundMessages += 1
def tally(self, key):
if key not in self.current:
self.current[key] = 1
else:
self.current[key] += 1
with self.lock:
if key not in self.current:
self.current[key] = 1
else:
self.current[key] += 1
def getInboundCount(self, minutes):
return sum(islice(self.inboundHistory, 0, min(minutes, self.max_minutes)))