{pg,my}sql: fix AttributeError on connection failure
If connection fails to be established, the acquired attribute does not exist and then you see warning such has: Exception AttributeError: "'MySQLLock' object has no attribute 'acquired'" in <bound method MySQLLock.__del__ of <tooz.drivers.mysql.MySQLLock object at 0x7f79479056d0>> Change-Id: Id61775483c91ba4127d9dd8cb56d6629a51d7081
This commit is contained in:
parent
d272845997
commit
df3363e2ea
|
@ -33,8 +33,8 @@ class MySQLLock(locking.Lock):
|
|||
|
||||
def __init__(self, name, parsed_url, options):
|
||||
super(MySQLLock, self).__init__(name)
|
||||
self._conn = MySQLDriver.get_connection(parsed_url, options)
|
||||
self.acquired = False
|
||||
self._conn = MySQLDriver.get_connection(parsed_url, options)
|
||||
|
||||
def acquire(self, blocking=True):
|
||||
|
||||
|
|
|
@ -93,8 +93,8 @@ class PostgresLock(locking.Lock):
|
|||
|
||||
def __init__(self, name, parsed_url, options):
|
||||
super(PostgresLock, self).__init__(name)
|
||||
self._conn = PostgresDriver.get_connection(parsed_url, options)
|
||||
self.acquired = False
|
||||
self._conn = PostgresDriver.get_connection(parsed_url, options)
|
||||
h = hashlib.md5()
|
||||
h.update(name)
|
||||
if six.PY2:
|
||||
|
|
Loading…
Reference in New Issue