diff options
author | Alexandre Flament <alex@al-f.net> | 2021-01-13 14:07:39 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2021-01-13 14:07:39 +0100 |
commit | 912c7e975c3943db798d748fa48d460467b66d30 (patch) | |
tree | 0dc84bbe549fac71ead7ee4e4fafeb0d3f3021c2 /searx/search/checker | |
parent | 7f0c508598cc2197e53b877dcf4c76e25a097c4f (diff) | |
download | searxng-912c7e975c3943db798d748fa48d460467b66d30.tar.gz searxng-912c7e975c3943db798d748fa48d460467b66d30.zip |
[fix] checker: don't run the checker when uwsgi is not properly configured
Before this commit, even with the scheduler disabled, the checker was running
at least once for each uwsgi worker.
Diffstat (limited to 'searx/search/checker')
-rw-r--r-- | searx/search/checker/background.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/searx/search/checker/background.py b/searx/search/checker/background.py index be30897bc..e41bff5f5 100644 --- a/searx/search/checker/background.py +++ b/searx/search/checker/background.py @@ -40,8 +40,9 @@ def get_result(): return json.loads(serialized_result) -def _set_result(result): - result['timestamp'] = int(time.time() / 3600) * 3600 +def _set_result(result, include_timestamp=True): + if include_timestamp: + result['timestamp'] = int(time.time() / 3600) * 3600 storage.set_str(CHECKER_RESULT, json.dumps(result)) @@ -82,8 +83,8 @@ def _run_with_delay(): def _start_scheduling(): every = _get_every() - schedule(every[0], _run_with_delay) - run() + if schedule(every[0], _run_with_delay): + run() def _signal_handler(signum, frame): @@ -111,7 +112,7 @@ def initialize(): return # - _set_result({'status': 'unknown'}) + _set_result({'status': 'unknown'}, include_timestamp=False) start_after = scheduling.get('start_after', (300, 1800)) start_after = _get_interval(start_after, 'checker.scheduling.start_after is not a int or list') |