Skip to content

Commit

Permalink
forceUpdate: true should await for redis (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloSzx committed Mar 13, 2023
1 parent 88af6f5 commit fd950d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-deers-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@soundxyz/fine-grained-cache": patch
---

When specifying forceUpdate: true, it should await for redis to set
8 changes: 4 additions & 4 deletions src/fineGrained.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ export function FineGrainedCache({
ttl: expirySeconds,
}).catch(onError);

if (awaitRedisSet) await set;
if (awaitRedisSet || forceUpdate) await set;
} else {
const tracing = enabledLogEvents?.REDIS_SET ? getTracing() : null;

Expand All @@ -704,7 +704,7 @@ export function FineGrainedCache({
})
.catch(onError);

if (awaitRedisSet) await set;
if (awaitRedisSet || forceUpdate) await set;
}
} else if (ttl === "Infinity") {
if (pipelineRedisSET) {
Expand All @@ -713,7 +713,7 @@ export function FineGrainedCache({
value: stringifiedValue,
}).catch(onError);

if (awaitRedisSet) await set;
if (awaitRedisSet || forceUpdate) await set;
} else {
const tracing = enabledLogEvents?.REDIS_SET ? getTracing() : null;

Expand All @@ -731,7 +731,7 @@ export function FineGrainedCache({
})
.catch(onError);

if (awaitRedisSet) await set;
if (awaitRedisSet || forceUpdate) await set;
}
} else if (enabledLogEvents?.REDIS_SKIP_SET) {
logMessage("REDIS_SKIP_SET", {
Expand Down

0 comments on commit fd950d8

Please sign in to comment.