Skip to content

Commit

Permalink
pybind/rados: Fix timeouts for small t
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
John Spray committed May 25, 2014
1 parent 04f8e0e commit 4c22c6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pybind/rados.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4c22c6f

Please sign in to comment.