]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/rados: Fix timeouts for small t 1869/head
authorJohn Spray <john.spray@inktank.com>
Sun, 25 May 2014 16:34:08 +0000 (17:34 +0100)
committerJohn Spray <john.spray@inktank.com>
Sun, 25 May 2014 16:34:08 +0000 (17:34 +0100)
Previously, if passing a number less than 0.5 for
the timeout, operations would always return
a failure status code.

The same problem would also generate premature timeouts
for operations which completed within 0.5s of
their timeout deadline.

Fix the logic so that we only decrement `countdown`
if the thread has not completed when returning from join().

Signed-off-by: John Spray <john.spray@inktank.com>
src/pybind/rados.py

index bb249473f562e01f58058bcc0abcdb47e57695a2..f51e7443286268065c44ef2afe429c196414f7cc 100644 (file)
@@ -159,7 +159,7 @@ def run_in_thread(target, args, timeout=0):
         # poll for thread exit
         while t.is_alive():
             t.join(POLL_TIME_INCR)
-            if timeout:
+            if timeout and t.is_alive():
                 countdown = countdown - POLL_TIME_INCR
                 if countdown <= 0:
                     raise KeyboardInterrupt