mirror of https://github.com/searxng/searxng.git
[pylint] checker/__main__.py & checker/background.py
Lint files that has been touched by [PR #58] [PR #58] https://github.com/searxng/searxng/pull/58 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
8c1a65d32f
commit
fa0d05c313
|
@ -1,4 +1,6 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
# pylint: disable=missing-module-docstring, missing-function-docstring
|
||||
|
||||
import sys
|
||||
import io
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
# pylint: disable=missing-module-docstring, missing-function-docstring
|
||||
|
||||
import json
|
||||
import random
|
||||
|
@ -34,7 +36,7 @@ def _get_every():
|
|||
return _get_interval(every, 'checker.scheduling.every is not a int or list')
|
||||
|
||||
|
||||
def get_result():
|
||||
def get_result(): # pylint: disable=inconsistent-return-statements
|
||||
serialized_result = storage.get_str(CHECKER_RESULT)
|
||||
if serialized_result is not None:
|
||||
return json.loads(serialized_result)
|
||||
|
@ -47,7 +49,7 @@ def _set_result(result, include_timestamp=True):
|
|||
|
||||
|
||||
def run():
|
||||
if not running.acquire(blocking=False):
|
||||
if not running.acquire(blocking=False): # pylint: disable=consider-using-with
|
||||
return
|
||||
try:
|
||||
logger.info('Starting checker')
|
||||
|
@ -66,7 +68,7 @@ def run():
|
|||
|
||||
_set_result(result)
|
||||
logger.info('Check done')
|
||||
except Exception:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_set_result({'status': 'error'})
|
||||
logger.exception('Error while running the checker')
|
||||
finally:
|
||||
|
@ -87,7 +89,7 @@ def _start_scheduling():
|
|||
run()
|
||||
|
||||
|
||||
def _signal_handler(signum, frame):
|
||||
def _signal_handler(_signum, _frame):
|
||||
t = threading.Thread(target=run)
|
||||
t.daemon = True
|
||||
t.start()
|
||||
|
|
Loading…
Reference in New Issue