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")