diff options
author | James Socol <james@bit.ly> | 2014-01-03 14:36:10 -0500 |
---|---|---|
committer | James Socol <james@bit.ly> | 2014-01-03 14:36:10 -0500 |
commit | 19f4361768ff99d562ce6ab8080f3fa6e7e89d58 (patch) | |
tree | 06c4ffdfe59a0135c9b01445d275b5e385dc5ea0 | |
parent | 22b53928d86b5fd5bffb76271f409ec75e6d55fb (diff) | |
download | pystatsd-19f4361768ff99d562ce6ab8080f3fa6e7e89d58.tar.gz |
Fix timers used as decorators.
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | statsd/client.py | 2 | ||||
-rw-r--r-- | statsd/tests.py | 5 |
3 files changed, 12 insertions, 1 deletions
@@ -1,6 +1,12 @@ Statsd Changelog ================ +Version 2.1.1 +------------- + +- Fix issue with timers used as decorators. + + Version 2.1 ----------- diff --git a/statsd/client.py b/statsd/client.py index 77207a4..1e3f80f 100644 --- a/statsd/client.py +++ b/statsd/client.py @@ -33,6 +33,8 @@ class Timer(object): self.stop() def start(self): + self.ms = None + self._sent = False self._start_time = time.time() return self diff --git a/statsd/tests.py b/statsd/tests.py index 4080a9c..54a3773 100644 --- a/statsd/tests.py +++ b/statsd/tests.py @@ -226,9 +226,12 @@ def test_timer_decorator(): pass bar() - _timer_check(sc, 1, 'bar', 'ms') + # Make sure the decorator works more than once: + bar() + _timer_check(sc, 2, 'bar', 'ms') + def test_timer_capture(): """You can capture the output of StatsClient.timer.""" |