diff --git a/ccmlib/scylla_node.py b/ccmlib/scylla_node.py index fe1a6fef..43429495 100644 --- a/ccmlib/scylla_node.py +++ b/ccmlib/scylla_node.py @@ -549,12 +549,14 @@ def _update_jmx_pid(self, wait=True): start = time.time() while not (os.path.isfile(pidfile) and os.stat(pidfile).st_size > 0): - if time.time() - start > 30.0 or not wait: - print_("Timed out waiting for pidfile {} to be filled (after {} seconds): File {} size={}".format( - pidfile, - 0 if not wait else time.time() - start, - 'exists' if os.path.isfile(pidfile) else 'does not exist' if not os.path.exists(pidfile) else 'is not a file', - os.stat(pidfile).st_size if os.path.exists(pidfile) else -1)) + elapsed = time.time() - start + if elapsed > 30.0 or not wait: + if wait: + print_("Timed out waiting for pidfile {} to be filled (after {} seconds): File {} size={}".format( + pidfile, + elapsed, + 'exists' if os.path.isfile(pidfile) else 'does not exist' if not os.path.exists(pidfile) else 'is not a file', + os.stat(pidfile).st_size if os.path.exists(pidfile) else -1)) break else: time.sleep(0.1)