libstore: asyncify LocalStore::invalidatePathChecked
Change-Id: I425b155e98d4d85f6d2f91841cbb8725e195a607
This commit is contained in:
+1
-1
@@ -793,7 +793,7 @@ try {
|
||||
if (!dead.insert(path).second) continue;
|
||||
if (shouldDelete) {
|
||||
try {
|
||||
invalidatePathChecked(path);
|
||||
TRY_AWAIT(invalidatePathChecked(path));
|
||||
deleteFromStore(path.to_string());
|
||||
referrersCache.erase(path);
|
||||
} catch (PathInUse &) {
|
||||
|
||||
@@ -1622,9 +1622,11 @@ std::pair<Path, AutoCloseFD> LocalStore::createTempDirInStore()
|
||||
}
|
||||
|
||||
|
||||
void LocalStore::invalidatePathChecked(const StorePath & path)
|
||||
{
|
||||
retrySQLite([&]() {
|
||||
kj::Promise<Result<void>> LocalStore::invalidatePathChecked(const StorePath & path)
|
||||
try {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines)
|
||||
TRY_AWAIT(retrySQLite([&]() -> kj::Promise<Result<void>> {
|
||||
try {
|
||||
auto state = dbPool.get();
|
||||
|
||||
SQLiteTxn txn = state->db.beginTransaction(SQLiteTxnType::Immediate);
|
||||
@@ -1639,7 +1641,14 @@ void LocalStore::invalidatePathChecked(const StorePath & path)
|
||||
}
|
||||
|
||||
txn.commit();
|
||||
}, always_progresses);
|
||||
co_return result::success();
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
}
|
||||
}));
|
||||
co_return result::success();
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ private:
|
||||
/**
|
||||
* Delete a path from the Nix store.
|
||||
*/
|
||||
void invalidatePathChecked(const StorePath & path);
|
||||
kj::Promise<Result<void>> invalidatePathChecked(const StorePath & path);
|
||||
|
||||
kj::Promise<Result<void>> verifyPath(const StorePath & path, const StorePathSet & store,
|
||||
StorePathSet & done, StorePathSet & validPaths, RepairFlag repair, bool & errors);
|
||||
|
||||
Reference in New Issue
Block a user