Only waithing when there is something to wait for
This commit is contained in:
parent
abd63a7fad
commit
837d3462be
@ -233,20 +233,23 @@ 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
|
||||
|
||||
total_successful_uploads = len([req for req in benchmark_results if req.upload_status_code == 200])
|
||||
all_arrived = False
|
||||
waiting_started = time.time()
|
||||
for _ in range(int(args.inflight_timeout * 1000)):
|
||||
if alerts_arrived_queue.qsize() >= total_successful_uploads:
|
||||
all_arrived = True
|
||||
break
|
||||
all_arrived = alerts_arrived_queue.qsize() >= total_successful_uploads
|
||||
|
||||
time.sleep(0.001)
|
||||
waited_for_inflight = time.time() - waiting_started
|
||||
print(f"Waited a total {waited_for_inflight} seconds")
|
||||
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:
|
||||
all_arrived = True
|
||||
break
|
||||
|
||||
time.sleep(0.001)
|
||||
waited_for_inflight = time.time() - waiting_started
|
||||
print(f"Waited a total {waited_for_inflight} seconds")
|
||||
|
||||
if not all_arrived:
|
||||
print("WARNING: Not all MQTT Messages arrived!")
|
||||
|
Loading…
Reference in New Issue
Block a user