Only waithing when there is something to wait for

This commit is contained in:
Pünkösd Marcell 2020-10-23 16:28:20 +02:00
parent abd63a7fad
commit 837d3462be

View File

@ -233,11 +233,14 @@ def main():
print("Running benchmark...")
benchmark_results = run_benchmark(args.workers, args.timeout, args.file)
print("Waiting for inflight MQTT messages to arrive...")
# Wait for inflight messages for a little
# Wait for inflight messages for a little
total_successful_uploads = len([req for req in benchmark_results if req.upload_status_code == 200])
all_arrived = False
all_arrived = alerts_arrived_queue.qsize() >= total_successful_uploads
if (not all_arrived) and (args.inflight_timeout > 0):
print("Waiting for inflight MQTT messages to arrive...")
waiting_started = time.time()
for _ in range(int(args.inflight_timeout * 1000)):
if alerts_arrived_queue.qsize() >= total_successful_uploads: