Permalink
Browse files

Fixed to be thread-safe.

* Removed class members to be thread-safe.
* Errors in release() should not be ignored.
  • Loading branch information...
1 parent 19b7d15 commit fdb3039b00229e2bca8c685208f6f1d7f10ea386 Satoshi Tanimoto committed Sep 13, 2012
Showing with 3 additions and 8 deletions.
  1. +3 −8 ddlockclient/__init__.py
@@ -91,10 +91,7 @@ def __enter__(self):
return self
def __exit__(self, type, val, tb):
- try:
- self.release()
- except:
- pass
+ self.release()
def __del__(self):
try:
@@ -104,12 +101,10 @@ def __del__(self):
class DDLockClient(object):
- servers = []
- sockcache = {}
- errmsg = ""
-
def __init__(self, servers=[]):
self.servers = servers
+ self.sockcache = {}
+ self.errmsg = ""
def get_sock_onlycache(self, addr):
return self.sockcache.get(addr)

0 comments on commit fdb3039

Please sign in to comment.