- minor fixes - migrate to CONFIG.TaskLimit instead of CALL_LIMIT global variable

This commit is contained in:
Dmytro Bogovych 2023-09-05 16:54:53 +03:00
parent 200b1f5cff
commit 644270fa51
1 changed files with 4 additions and 6 deletions

View File

@ -35,9 +35,6 @@ TASK_LIST: utils_qualtest.TaskList = utils_qualtest.TaskList()
# Number of finished calls # Number of finished calls
CALL_COUNTER = multiprocessing.Value('i', 0) CALL_COUNTER = multiprocessing.Value('i', 0)
# Maximum number of calls to to. Zero means unlimited number of calls.
CALL_LIMIT = 0
# Find script's directory # Find script's directory
DIR_THIS = Path(__file__).resolve().parent DIR_THIS = Path(__file__).resolve().parent
DIR_PROJECT = DIR_THIS.parent DIR_PROJECT = DIR_THIS.parent
@ -261,7 +258,8 @@ def make_call(target: str):
def perform_answerer(): def perform_answerer():
global CALL_LIMIT if CONFIG.PreparedReferenceAudio.exists():
os.remove(CONFIG.PreparedReferenceAudio)
# Prepare answering file - this must be prepended with few seconds of silence which can be eatean by call setup procedure # Prepare answering file - this must be prepended with few seconds of silence which can be eatean by call setup procedure
utils.prepare_reference_file(fname=str(CONFIG.ReferenceAudio), utils.prepare_reference_file(fname=str(CONFIG.ReferenceAudio),
@ -398,9 +396,9 @@ def run_probe():
run_caller_task(t) run_caller_task(t)
utils.log_verbose(f'Call #{CALL_COUNTER.value} finished') utils.log_verbose(f'Call #{CALL_COUNTER.value} finished')
if CALL_COUNTER.value >= CALL_LIMIT and CALL_LIMIT > 0: if CALL_COUNTER.value >= CONFIG.TaskLimit and CONFIG.TaskLimit > 0:
# Time to exit from the script # Time to exit from the script
utils.log(f'Call limit {CALL_LIMIT} hit, exiting.') utils.log(f'Call limit {CONFIG.TaskLimit} hit, exiting.')
return return
except Exception as err: except Exception as err: