Skip to content

Commit

Permalink
Add reset() method to StatsLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
thobbs committed Oct 26, 2012
1 parent fa372b6 commit 6027b3c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pycassa/logging/pool_stats_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class StatsLogger(object):
"""

def __init__(self):
#some callbacks are already locked by pool_lock, it's just simpler to have a global here for all operations
self.lock = threading.Lock()
self.reset()

@sync('lock')
def reset(self):
""" Reset all counters to 0 """
self._stats = {
'created': {
'success': 0,
Expand All @@ -71,8 +78,6 @@ def __init__(self):
'at_max': 0
}

#some callbacks are already locked by pool_lock, it's just simpler to have a global here for all operations
self.lock = threading.Lock()

def name_changed(self, new_logger):
self.logger = new_logger
Expand Down

0 comments on commit 6027b3c

Please sign in to comment.