feat: Option to save cache asyncronously (#2883)

This PR adds an option to save cache to file asynchronously in parallel
with shutting down the rest of Clio services.
This commit is contained in:
Sergey Kuznetsov
2026-01-07 17:20:56 +00:00
committed by GitHub
parent 79c08fc735
commit 9f76eabf0a
6 changed files with 85 additions and 13 deletions

View File

@@ -30,7 +30,9 @@
namespace data {
LedgerCacheSaver::LedgerCacheSaver(util::config::ClioConfigDefinition const& config, LedgerCacheInterface const& cache)
: cacheFilePath_(config.maybeValue<std::string>("cache.file.path")), cache_(cache)
: cacheFilePath_(config.maybeValue<std::string>("cache.file.path"))
, cache_(cache)
, isAsync_(config.get<bool>("cache.file.async_save"))
{
}
@@ -56,6 +58,9 @@ LedgerCacheSaver::save()
LOG(util::LogService::error()) << "Error saving LedgerCache to file: " << success.error();
}
});
if (not isAsync_) {
waitToFinish();
}
}
void