Skip to content

Commit

Permalink
Fix pipelined set
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloSzx committed Aug 8, 2022
1 parent 48a6a64 commit 662d8d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-pillows-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@soundxyz/fine-grained-cache": patch
---

Fix pipelined set
5 changes: 3 additions & 2 deletions src/fineGrained.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export function FineGrainedCache({
}
}

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

let pendingRedisSetTimeout: ReturnType<typeof setTimeout> | undefined;

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

pendingRedisSetTimeout = setTimeout(executePipeline);
Expand All @@ -328,7 +329,7 @@ export function FineGrainedCache({
| [cmd: "setex", key: string, ttl: number, value: string]
>;
}>(
(acc, { key, promise, ttl }, index) => {
(acc, { key, promise, ttl, value }, index) => {
acc.promises[index] = {
promise,
index,
Expand Down

0 comments on commit 662d8d1

Please sign in to comment.