fix: cache set race
This commit is contained in:
parent
729f6822d5
commit
9553f8b436
1 changed files with 3 additions and 2 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue