fix: cache set race

This commit is contained in:
Nicolas Meienberger 2026-06-05 21:38:27 +02:00
parent 729f6822d5
commit 9553f8b436
No known key found for this signature in database

View file

@ -687,9 +687,10 @@ const getSnapshotDetails = async (shortId: ShortId, snapshotId: string) => {
if (!snapshots) { if (!snapshots) {
snapshots = await repoMutex.runShared(repository.id, `snapshot_details:${snapshotId}`, async ({ signal }) => { snapshots = await repoMutex.runShared(repository.id, `snapshot_details:${snapshotId}`, async ({ signal }) => {
return await runEffectPromise(restic.snapshots(repository.config, { organizationId, signal })); const snapshots = await runEffectPromise(restic.snapshots(repository.config, { organizationId, signal }));
cache.set(cacheKey, snapshots);
return snapshots;
}); });
cache.set(cacheKey, snapshots);
} }
const snapshot = snapshots.find((snap) => snap.id === snapshotId || snap.short_id === snapshotId); const snapshot = snapshots.find((snap) => snap.id === snapshotId || snap.short_id === snapshotId);