[fix] checker: fix engine statistics

Without this commit, the URL /stats/errors shows percentage above 100% after the checker has run.
This commit is contained in:
Alexandre Flament 2021-01-17 16:14:16 +01:00
parent ca76f3119a
commit d473407ec9
3 changed files with 7 additions and 4 deletions

View file

@ -53,9 +53,9 @@ def add_error_context(engine_name: str, error_context: ErrorContext) -> None:
def get_trace(traces):
for trace in reversed(traces):
split_filename = trace.filename.split('/')
if len(split_filename) > 3 and '/'.join(split_filename[-3:-1]) == 'searx/engines':
if '/'.join(split_filename[-3:-1]) == 'searx/engines':
return trace
if len(split_filename) > 3 and '/'.join(split_filename[-4:-1]) == 'searx/search/processors':
if '/'.join(split_filename[-4:-1]) == 'searx/search/processors':
return trace
return traces[-1]