From 2a135de11a9ea5fb4cf4c88a83e259365ec5bd14 Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Thu, 12 Dec 2024 19:58:37 +0000 Subject: [PATCH] Allocate all SQLite pool handles on init --- sqlitecluster/SQLitePool.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sqlitecluster/SQLitePool.cpp b/sqlitecluster/SQLitePool.cpp index ca3d7a4ad..f1669c938 100644 --- a/sqlitecluster/SQLitePool.cpp +++ b/sqlitecluster/SQLitePool.cpp @@ -13,6 +13,12 @@ SQLitePool::SQLitePool(size_t maxDBs, _baseDB(filename, cacheSize, maxJournalSize, minJournalTables, mmapSizeGB, hctree), _objects(_maxDBs, nullptr) { + SINFO("Allocating SQLitePool handles."); + for (size_t i = 0; i < _maxDBs; i++) { + initializeIndex(i); + _availableHandles.insert(i); + } + SINFO("Allocated " << _maxDBs << " handles for SQLitePool."); } SQLitePool::~SQLitePool() {