From 71356aa9c8536963024c22f18e96ab28b657236e Mon Sep 17 00:00:00 2001 From: ZhymabekRoman Date: Fri, 23 Feb 2024 14:16:42 +0600 Subject: [PATCH] Update maintenance --- database-lib/database_lib/cache_db.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/database-lib/database_lib/cache_db.py b/database-lib/database_lib/cache_db.py index 17fafa8..b3815e1 100644 --- a/database-lib/database_lib/cache_db.py +++ b/database-lib/database_lib/cache_db.py @@ -101,6 +101,12 @@ class SQLiteCacheBackend: def maintenance(self, time: int = None, blocking_time: int = 0.5): connection = sqlite3.connect(self.database) cursor = connection.cursor() + connection.enable_load_extension(True) # Enable loading of extensions + connection.execute("PRAGMA foreign_keys = ON;") # Need for working with foreign keys in db + connection.execute("PRAGMA journal_mode=WAL;") # Need to properly work with ZSTD compression + connection.execute("PRAGMA auto_vacuum=full;") # Same as above thing + if sqlite_zstd is not None: + sqlite_zstd.load(connection) with connection: if time is not None: cursor.execute("SELECT zstd_incremental_maintenance(?, ?);", (time, blocking_time))