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
[fix] no such table during engine init (#6185)
Brock Vojkovic9d49a9f344f1
diff --git a/searx/sqlitedb.py b/searx/sqlitedb.pyindex a4f498339..de6f1b803 100644--- a/searx/sqlitedb.py+++ b/searx/sqlitedb.py@@ -327,7 +327,6 @@ class SQLiteAppl(abc.ABC):if self._init_done:return False- self._init_done = Truelogger.debug("init DB: %s", self.db_url)self.properties.init(conn)@@ -342,6 +341,7 @@ 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 = Truereturn Truedef create_schema(self, conn: sqlite3.Connection):@@ -369,6 +369,9 @@ class SQLiteProperties(SQLiteAppl):"""+ _locks: dict[str, threading.Lock] = {}+ _locks_lock = threading.Lock()+SQLITE_JOURNAL_MODE: str = "WAL"DDL_PROPERTIES: str = """\@@ -406,11 +409,16 @@ CREATE TABLE IF NOT EXISTS properties (if self._init_done:return False- 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)+ 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 = Truereturn Truedef __call__(self, name: str, default: t.Any = None) -> t.Any: