SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[mod] move hook to set Unix thread name into searx.unixthreadname
Alexandre Flament70bbd14b1ae1
diff --git a/searx/__init__.py b/searx/__init__.pyindex a65266de8..8452dd7b4 100644--- a/searx/__init__.py+++ b/searx/__init__.py@@ -5,6 +5,7 @@from os.path import dirname, abspathimport logging+import searx.unixthreadnameimport searx.settings_loaderfrom searx.settings_defaults import settings_set_defaultsdiff --git a/searx/unixthreadname.py b/searx/unixthreadname.pynew file mode 100644index 000000000..9a6f53813--- /dev/null+++ b/searx/unixthreadname.py@@ -0,0 +1,20 @@+# SPDX-License-Identifier: AGPL-3.0-or-later+# lint: pylint+"""+if setproctitle is installed.+set Unix thread name with the Python thread name+"""++try:+ import setproctitle+except ImportError:+ pass+else:+ import threading+ old_thread_init = threading.Thread.__init__++ def new_thread_init(self, *args, **kwargs):+ # pylint: disable=protected-access, disable=c-extension-no-member, disable=missing-function-docstring+ old_thread_init(self, *args, **kwargs)+ setproctitle.setthreadtitle(self._name)+ threading.Thread.__init__ = new_thread_initdiff --git a/searx/webapp.py b/searx/webapp.pyindex 9c2374200..9ce23d3c1 100755--- a/searx/webapp.py+++ b/searx/webapp.py@@ -111,21 +111,6 @@ from searx.network import stream as http_streamfrom searx.search.checker import get_result as checker_get_resultfrom searx.settings_loader import get_default_settings_path-# set Unix thread name-try:- import setproctitle-except ImportError:- pass-else:- import threading- old_thread_init = threading.Thread.__init__-- def new_thread_init(self, *args, **kwargs):- # pylint: disable=protected-access, disable=c-extension-no-member- old_thread_init(self, *args, **kwargs)- setproctitle.setthreadtitle(self._name)- threading.Thread.__init__ = new_thread_init-logger = logger.getChild('webapp')# check secret_key