summaryrefslogtreecommitdiff
path: root/searx/sqlitedb.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2026-06-07 09:23:35 +0200
committerGitHub <noreply@github.com>2026-06-07 09:23:35 +0200
commit70de3cc5611e69aae7d5756efffb8852c63b7e64 (patch)
tree8e7f0cad335c80f3afea8dab1e5e4976aab2f564 /searx/sqlitedb.py
parent51b6fd4f23f69ebb100cc3f07bd74c001ab7a470 (diff)
Revert "[fix] no such table during engine init (#6185)" (#6215)
This reverts commit 9d49a9f344f17b069ba8e6b6720db74991e7ca4b.
Diffstat (limited to 'searx/sqlitedb.py')
-rw-r--r--searx/sqlitedb.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/searx/sqlitedb.py b/searx/sqlitedb.py
index de6f1b803..a4f498339 100644
--- a/searx/sqlitedb.py
+++ b/searx/sqlitedb.py
@@ -327,6 +327,7 @@ class SQLiteAppl(abc.ABC):
if self._init_done:
return False
+ self._init_done = True
logger.debug("init DB: %s", self.db_url)
self.properties.init(conn)
@@ -341,7 +342,6 @@ class SQLiteAppl(abc.ABC):
raise sqlite3.DatabaseError("Expected DB schema v%s, DB schema is v%s" % (self.DB_SCHEMA, ver))
logger.debug("DB_SCHEMA = %s", ver)
- self._init_done = True
return True
def create_schema(self, conn: sqlite3.Connection):
@@ -369,9 +369,6 @@ class SQLiteProperties(SQLiteAppl):
"""
- _locks: dict[str, threading.Lock] = {}
- _locks_lock = threading.Lock()
-
SQLITE_JOURNAL_MODE: str = "WAL"
DDL_PROPERTIES: str = """\
@@ -409,16 +406,11 @@ CREATE TABLE IF NOT EXISTS properties (
if self._init_done:
return False
- with self._locks_lock:
- db_lock = self._locks.setdefault(self.db_url, threading.Lock())
- with db_lock:
- if self._init_done:
- return False
- logger.debug("init properties of DB: %s", self.db_url)
- res = conn.execute(self.SQL_TABLE_EXISTS)
- if res.fetchone() is None: # DB schema needs to be be created
- self.create_schema(conn)
- self._init_done = True
+ self._init_done = True
+ logger.debug("init properties of DB: %s", self.db_url)
+ res = conn.execute(self.SQL_TABLE_EXISTS)
+ if res.fetchone() is None: # DB schema needs to be be created
+ self.create_schema(conn)
return True
def __call__(self, name: str, default: t.Any = None) -> t.Any: