Skip to content

Commit

Permalink
Fix "pipelineRedisSET: false"
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloSzx committed Aug 10, 2022
1 parent de7c39b commit fb9397b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-socks-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@soundxyz/fine-grained-cache": patch
---

Fix "pipelineRedisSET: false"
13 changes: 9 additions & 4 deletions src/fineGrained.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ export function FineGrainedCache({
}
}

let pendingRedisSets: { key: string; promise: DeferredPromise<void>; value: string; ttl?: number }[] = [];
let pendingRedisSets: {
key: string;
promise: DeferredPromise<void>;
value: string;
ttl?: number;
}[] = [];

let pendingRedisSetTimeout: ReturnType<typeof setTimeout> | undefined;

Expand All @@ -306,7 +311,7 @@ export function FineGrainedCache({
key,
promise,
ttl,
value
value,
});

pendingRedisSetTimeout = setTimeout(executePipeline);
Expand Down Expand Up @@ -658,7 +663,7 @@ export function FineGrainedCache({
: JSON.stringify(newValue);

if (expirySeconds > 0) {
if (pipelineRedisSET != null) {
if (pipelineRedisSET) {
const set = pipelinedRedisSet({
key,
value: stringifiedValue,
Expand Down Expand Up @@ -686,7 +691,7 @@ export function FineGrainedCache({
if (awaitRedisSet) await set;
}
} else if (ttl === "Infinity") {
if (pipelineRedisSET != null) {
if (pipelineRedisSET) {
const set = pipelinedRedisSet({
key,
value: stringifiedValue,
Expand Down

0 comments on commit fb9397b

Please sign in to comment.