From 40760065070a003c229ca10a7bd9af6eb9b660c2 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Fri, 15 Feb 2013 20:59:06 +0000 Subject: [PATCH] openstack_container.py: improve name of _auth_lock; simplify by using DeferredLock.run. Signed-off-by: David-Sarah Hopwood --- .../backends/cloud/openstack/openstack_container.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/allmydata/storage/backends/cloud/openstack/openstack_container.py b/src/allmydata/storage/backends/cloud/openstack/openstack_container.py index 0aa20996..b1b40052 100644 --- a/src/allmydata/storage/backends/cloud/openstack/openstack_container.py +++ b/src/allmydata/storage/backends/cloud/openstack/openstack_container.py @@ -77,7 +77,7 @@ class AuthenticationClient(object): # Not authorized yet. self._auth_info = None - self._first_auth_lock = defer.DeferredLock() + self._auth_lock = defer.DeferredLock() d = self.get_auth_info() d.addBoth(lambda ign: None) @@ -89,12 +89,7 @@ class AuthenticationClient(object): return self.get_auth_info_locked() def get_auth_info_locked(self, suppress_errors=False): - d = self._first_auth_lock.acquire() - d.addCallback(self._authenticate) - def _release(res): - self._first_auth_lock.release() - return res - d.addBoth(_release) + d = self._auth_lock.run(self._authenticate) d.addCallback(lambda ign: self._auth_info) if suppress_errors: d.addErrback(lambda ign: self._auth_info) -- 2.45.2