From e9ebf66819e3c8294528c54eedb7f593a1c8625f Mon Sep 17 00:00:00 2001 From: erfanva Date: Tue, 17 May 2022 15:03:43 +0430 Subject: [PATCH] set scanIterator starting cursor from options Before this commit, the cursor was always 0. --- packages/client/lib/client/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/client/lib/client/index.ts b/packages/client/lib/client/index.ts index fb86908bd2f..35ad7d040ed 100644 --- a/packages/client/lib/client/index.ts +++ b/packages/client/lib/client/index.ts @@ -621,7 +621,7 @@ export default class RedisClient< } async* scanIterator(options?: ScanCommandOptions): AsyncIterable { - let cursor = 0; + let cursor = (options && options.CURSOR) || 0; do { const reply = await (this as any).scan(cursor, options); cursor = reply.cursor; @@ -632,7 +632,7 @@ export default class RedisClient< } async* hScanIterator(key: string, options?: ScanOptions): AsyncIterable> { - let cursor = 0; + let cursor = (options && options.CURSOR) || 0; do { const reply = await (this as any).hScan(key, cursor, options); cursor = reply.cursor; @@ -643,7 +643,7 @@ export default class RedisClient< } async* sScanIterator(key: string, options?: ScanOptions): AsyncIterable { - let cursor = 0; + let cursor = (options && options.CURSOR) || 0; do { const reply = await (this as any).sScan(key, cursor, options); cursor = reply.cursor; @@ -654,7 +654,7 @@ export default class RedisClient< } async* zScanIterator(key: string, options?: ScanOptions): AsyncIterable> { - let cursor = 0; + let cursor = (options && options.CURSOR) || 0; do { const reply = await (this as any).zScan(key, cursor, options); cursor = reply.cursor;