|
|
@@ -63,19 +63,29 @@ export class RedisInspectorService {
|
|
|
}
|
|
|
|
|
|
async scan(dto: ScanRedisKeysDto): Promise<RedisInspectorScanResult> {
|
|
|
- const cursor = this.normalizeCursor(dto.cursor);
|
|
|
const count = this.normalizePageSize(dto.pageSize);
|
|
|
const matchPattern = this.buildMatchPattern(dto);
|
|
|
- const [cursorNext, keys] = await this.redisService.scan(
|
|
|
- cursor,
|
|
|
- 'MATCH',
|
|
|
- matchPattern,
|
|
|
- 'COUNT',
|
|
|
- count,
|
|
|
- );
|
|
|
+ let cursor = this.normalizeCursor(dto.cursor);
|
|
|
+ const keys: string[] = [];
|
|
|
+
|
|
|
+ do {
|
|
|
+ const [cursorNext, batch] = await this.redisService.scan(
|
|
|
+ cursor,
|
|
|
+ 'MATCH',
|
|
|
+ matchPattern,
|
|
|
+ 'COUNT',
|
|
|
+ count,
|
|
|
+ );
|
|
|
+
|
|
|
+ if (batch?.length) {
|
|
|
+ keys.push(...batch);
|
|
|
+ }
|
|
|
+
|
|
|
+ cursor = cursorNext;
|
|
|
+ } while (cursor !== '0' && keys.length < count);
|
|
|
|
|
|
if (!keys?.length) {
|
|
|
- return { cursorNext, items: [] };
|
|
|
+ return { cursorNext: cursor, items: [] };
|
|
|
}
|
|
|
|
|
|
const details = await this.redisService.pipelineTypeTtl(keys);
|
|
|
@@ -86,7 +96,7 @@ export class RedisInspectorService {
|
|
|
}));
|
|
|
|
|
|
return {
|
|
|
- cursorNext,
|
|
|
+ cursorNext: cursor,
|
|
|
items,
|
|
|
};
|
|
|
}
|