Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

beware the threading monster

  • Loading branch information...
commit 6f9607c6c2cdb75f3b895169274767c5276040ad 1 parent 3986ba5
Jeff Balogh authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 statsd/
7 statsd/
@@ -16,7 +16,12 @@ class _Timer(object):
_local = threading.local()
def __init__(self, cl):
- self.client = cl
+ # We have to make sure the client is attached directly to __dict__
+ # because the __setattr__ below is so clever. Otherwise the client
+ # becomes a thread-local object even though the connection is for the
+ # whole process. This error was witnessed under mod_wsgi when using an
+ # ImportScript.
+ self.__dict__['client'] = cl
def __delattr__(self, attr):
"""Store thread-local data safely."""
Please sign in to comment.
Something went wrong with that request. Please try again.