mirror of
https://github.com/searxng/searxng.git
synced 2025-07-13 08:19:17 +02:00
[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>
This commit is contained in:
parent
f798ddd492
commit
2fe8540903
4 changed files with 13 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue