diff options
| author | Markus Heiser <markus.heiser@darmarIT.de> | 2025-07-09 17:32:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-09 17:32:10 +0200 |
| commit | 2fe8540903c53e3939c86dad6f7f7c0b3162de0f (patch) | |
| tree | 64f2acede11c732570a64fca37e6e6eee341b1ee /searx/plugins | |
| parent | f798ddd4922d793d5e6ccb7c4111810d549ff4f4 (diff) | |
[fix] prevent multiple, parallel initializations of tables in the cache DB (#4991)
Depending on the respective runtime behavior, it could happen that the initial
loading of the DB tables in the cache was performed multiple times and in
parallel. The concurrent accesses then led to the `sqlite3.OperationalError:
database is locked` exception as in #4951.
Since this problem depends significantly on the runtimes (e.g., how long it
takes to retrieve the content for a table), this error could not be observed in
all installations.
Closes: https://github.com/searxng/searxng/issues/4951
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/plugins')
| -rw-r--r-- | searx/plugins/tracker_url_remover.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/searx/plugins/tracker_url_remover.py b/searx/plugins/tracker_url_remover.py index b7e8e25f3..190744586 100644 --- a/searx/plugins/tracker_url_remover.py +++ b/searx/plugins/tracker_url_remover.py @@ -13,6 +13,7 @@ from searx.data import TRACKER_PATTERNS from . import Plugin, PluginInfo if typing.TYPE_CHECKING: + import flask from searx.search import SearchWithPlugins from searx.extended_types import SXNG_Request from searx.result_types import Result, LegacyResult @@ -37,6 +38,10 @@ class SXNGPlugin(Plugin): preference_section="privacy", ) + def init(self, app: "flask.Flask") -> bool: + TRACKER_PATTERNS.init() + return True + def on_result(self, request: "SXNG_Request", search: "SearchWithPlugins", result: Result) -> bool: result.filter_urls(self.filter_url_field) |