lib: fix batch-size after db creation

Ensure we use the user-specified batch-size immediately after db creation.
This commit is contained in:
Dirk-Jan C. Binnema
2024-05-26 11:04:27 +03:00
parent 7c22e95b5e
commit 1e9f772e0a
3 changed files with 21 additions and 4 deletions

View File

@ -101,7 +101,7 @@ make_db(const std::string& db_path, Flavor flavor)
XapianDb::XapianDb(const std::string& db_path, Flavor flavor):
path_(make_path(db_path, flavor)),
db_(make_db(path_, flavor)),
batch_size_{Config(*this).get<Config::Id::BatchSize>()}
batch_size_{Config(*this).get<Config::Id::BatchSize>()} // default
{
if (flavor == Flavor::CreateOverwrite)
set_timestamp(MetadataIface::created_key);
@ -109,6 +109,12 @@ XapianDb::XapianDb(const std::string& db_path, Flavor flavor):
mu_debug("created {} / {} (batch-size: {})", flavor, *this, batch_size_);
}
void
XapianDb::reinit() {
batch_size_ = Config(*this).get<Config::Id::BatchSize>();
mu_debug("set batch-size to {}", batch_size_);
}
#ifdef BUILD_TESTS
/*