diff options
| author | Joshua Harlow <harlowja@yahoo-inc.com> | 2016-01-06 15:10:04 -0800 |
|---|---|---|
| committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2016-01-06 15:10:33 -0800 |
| commit | 47e5249290c19728fde673f1038a1e777ac332e7 (patch) | |
| tree | 3ef6348980a17233e043e17afca40562c2a6245e /tooz/drivers/etcd.py | |
| parent | 4bc03a24c85bbc1747771e204b171f4b48024091 (diff) | |
| download | tooz-47e5249290c19728fde673f1038a1e777ac332e7.tar.gz | |
Use utils.convert_blocking to convert blocking argument
Change-Id: I019cd7b7a65636fe5283f83c890f59d48a6efbb3
Diffstat (limited to 'tooz/drivers/etcd.py')
| -rw-r--r-- | tooz/drivers/etcd.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tooz/drivers/etcd.py b/tooz/drivers/etcd.py index 449ca09..dd72bea 100644 --- a/tooz/drivers/etcd.py +++ b/tooz/drivers/etcd.py @@ -86,11 +86,12 @@ class EtcdLock(locking.Lock): ) def acquire(self, blocking=True): - if isinstance(blocking, bool): - watch = None - else: - watch = timeutils.StopWatch(duration=blocking) + blocking, timeout = utils.convert_blocking(blocking) + if timeout is not None: + watch = timeutils.StopWatch(duration=timeout) watch.start() + else: + watch = None while True: try: @@ -109,7 +110,7 @@ class EtcdLock(locking.Lock): return True # We didn't get the lock and we don't want to wait - if blocking is False: + if not blocking: return False # Ok, so let's wait a bit (or forever!) |
