From 34d019f4836f7aaa3c61c8e12595aa165defd4f6 Mon Sep 17 00:00:00 2001 From: christianEQ Date: Wed, 17 Mar 2021 19:50:28 +0000 Subject: [PATCH] fixed runtime arg for monkey Former-commit-id: b3e6e1f13b3d24c92d9f7e8441831232f47ff053 --- monkey/monkey.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/monkey.py b/monkey/monkey.py index 07f157961..3c23874a8 100644 --- a/monkey/monkey.py +++ b/monkey/monkey.py @@ -211,13 +211,14 @@ def stats_thread(): global g_exit global runtime i = 0 - while not g_exit and not (runtime and i > runtime): + while not g_exit and not (runtime and i >= runtime): time.sleep(1) print("Ops per second: " + str({k:v for (k,v) in ops.items() if v})) #print(f"Blocked threads: {len(list(filter(lambda x: x.blocked, clients)))}") clear_ops() i += 1 g_exit = True + asyncore.close_all() def flush_db_sync(): server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -253,7 +254,7 @@ def init_lpush(): def main(test, flush): global g_exit - + clear_ops() if flush: @@ -272,8 +273,7 @@ def main(test, flush): threading.Thread(target=stats_thread).start() asyncore.loop() g_exit = True - sys.exit(0) - print("DONE") + print("Done.") parser = argparse.ArgumentParser(description="Test use cases for KeyDB.") parser.add_argument('test', choices=[x[5:] for x in filter(lambda name: name.startswith("init_"), globals().keys())], help="which test to run")