diff --git a/lix/libstore/binary-cache-store.cc b/lix/libstore/binary-cache-store.cc index 184d98e7f..1505416c4 100644 --- a/lix/libstore/binary-cache-store.cc +++ b/lix/libstore/binary-cache-store.cc @@ -86,8 +86,8 @@ std::string BinaryCacheStore::narInfoFileFor(const StorePath & storePath) return std::string(storePath.hashPart()) + ".narinfo"; } -void BinaryCacheStore::writeNarInfo(ref narInfo) -{ +kj::Promise> BinaryCacheStore::writeNarInfo(ref narInfo) +try { auto narInfoFile = narInfoFileFor(narInfo->path); upsertFile(narInfoFile, narInfo->to_string(*this), "text/x-nix-narinfo"); @@ -101,6 +101,9 @@ void BinaryCacheStore::writeNarInfo(ref narInfo) if (diskCache) diskCache->upsertNarInfo(getUri(), std::string(narInfo->path.hashPart()), std::shared_ptr(narInfo)); + co_return result::success(); +} catch (...) { + co_return result::current_exception(); } kj::Promise>> BinaryCacheStore::addToStoreCommon( @@ -258,7 +261,7 @@ try { /* Atomically write the NAR info file.*/ if (secretKey) narInfo->sign(*this, *secretKey); - writeNarInfo(narInfo); + TRY_AWAIT(writeNarInfo(narInfo)); stats.narInfoWrite++; @@ -537,7 +540,7 @@ try { narInfo->sigs.insert(sigs.begin(), sigs.end()); - writeNarInfo(narInfo); + TRY_AWAIT(writeNarInfo(narInfo)); co_return result::success(); } catch (...) { co_return result::current_exception(); diff --git a/lix/libstore/binary-cache-store.hh b/lix/libstore/binary-cache-store.hh index 8f6d0e9ce..15ab4485c 100644 --- a/lix/libstore/binary-cache-store.hh +++ b/lix/libstore/binary-cache-store.hh @@ -101,7 +101,7 @@ private: std::string narInfoFileFor(const StorePath & storePath); - void writeNarInfo(ref narInfo); + kj::Promise> writeNarInfo(ref narInfo); kj::Promise>> addToStoreCommon( AsyncInputStream & narSource, RepairFlag repair, CheckSigsFlag checkSigs,