From 7a18850877ca77a2e47afe414e7fd095d4547097 Mon Sep 17 00:00:00 2001 From: pyth0n1c <87383215+pyth0n1c@users.noreply.github.com> Date: Mon, 6 Jun 2022 16:53:15 -0700 Subject: [PATCH] Forcing a timeout... certain indexes may continue growing and never have the same number of events! --- bin/docker_detection_tester/modules/splunk_sdk.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/docker_detection_tester/modules/splunk_sdk.py b/bin/docker_detection_tester/modules/splunk_sdk.py index f919502db1..b0526caecd 100644 --- a/bin/docker_detection_tester/modules/splunk_sdk.py +++ b/bin/docker_detection_tester/modules/splunk_sdk.py @@ -94,11 +94,13 @@ def get_number_of_indexed_events(splunk_host, splunk_port, splunk_password, inde def wait_for_indexing_to_complete(splunk_host, splunk_port, splunk_password, sourcetype:str, index:str, check_interval_seconds:int=10)->bool: - + MAX_WAIT_TIME = 60 startTime = timeit.default_timer() previous_count = -1 time.sleep(check_interval_seconds) while True: + if (timeit.default_timer() - startTime) > 60: + print("force timeout! assume we are done indexing") new_count = get_number_of_indexed_events(splunk_host, splunk_port, splunk_password, index=index, sourcetype=sourcetype) #print(f"Previous Count [{previous_count}] New Count [{new_count}]") if previous_count == -1: