Skip to content

Commit 56c82c3

Browse files
committed
fix: scan+hscan logging
1 parent 3a63820 commit 56c82c3

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

src/SyncedMap.ts

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,26 @@ export class SyncedMap<V> {
8989

9090
try {
9191
do {
92-
const remoteItems = await this.client.hScan(
93-
getTimeoutRedisCommandOptions(this.timeoutMs),
94-
this.keyPrefix + this.redisKey,
95-
cursor,
96-
hScanOptions,
92+
const remoteItems = await redisErrorHandler(
93+
'SyncedMap.initialSync(), operation: hScan ' +
94+
this.syncChannel +
95+
' ' +
96+
this.timeoutMs +
97+
'ms' +
98+
' ' +
99+
this.keyPrefix +
100+
' ' +
101+
this.redisKey +
102+
' ' +
103+
cursor +
104+
' ' +
105+
this.querySize,
106+
this.client.hScan(
107+
getTimeoutRedisCommandOptions(this.timeoutMs),
108+
this.keyPrefix + this.redisKey,
109+
cursor,
110+
hScanOptions,
111+
),
97112
);
98113
for (const { field, value } of remoteItems.tuples) {
99114
if (this.filterKeys(field)) {
@@ -118,10 +133,17 @@ export class SyncedMap<V> {
118133
let remoteKeys: string[] = [];
119134
try {
120135
do {
121-
const remoteKeysPortion = await this.client.scan(
122-
getTimeoutRedisCommandOptions(this.timeoutMs),
123-
cursor,
124-
scanOptions,
136+
const remoteKeysPortion = await redisErrorHandler(
137+
'SyncedMap.cleanupKeysNotInRedis(), operation: scan ' +
138+
this.timeoutMs +
139+
'ms' +
140+
' ' +
141+
this.keyPrefix,
142+
this.client.scan(
143+
getTimeoutRedisCommandOptions(this.timeoutMs),
144+
cursor,
145+
scanOptions,
146+
),
125147
);
126148
remoteKeys = remoteKeys.concat(remoteKeysPortion.keys);
127149
cursor = remoteKeysPortion.cursor;

0 commit comments

Comments
 (0)