Skip to content

Commit

Permalink
fix: send multiple delete commands for clear to avoid CROSSLOT errors…
Browse files Browse the repository at this point in the history
… in clusters
  • Loading branch information
SaurusXI committed Jan 11, 2023
1 parent 765ad53 commit 2c40505
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ export class SugarCache {
this.logger.debug(`[SugarCache:${this.namespace}] Deletion candidate keys - ${deletionCandidateKeys}`);
if (!deletionCandidateKeys.length) return;

await this.redis.del(...deletionCandidateKeys);
await Promise.all(deletionCandidateKeys.map(k => this.redis.del(k)));

this.logger.debug(`[SugarCache:${this.namespace}] Deletion keys removed`);
}

// ----------- Decorator Methods -----------
Expand Down

0 comments on commit 2c40505

Please sign in to comment.