diff options
author | Ofir Luzon <ofirluzon@gmail.com> | 2021-10-13 06:54:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 16:54:35 +0300 |
commit | 49d26a9658f7ee4a4b5d65cd71b66a4cfcccfbaa (patch) | |
tree | 7a8dfb4ce9338fae8b798bbad98361f18bc6bdb7 /src/redis-cli.c | |
parent | a6b5d518a98b2760dce137e1696b983aa91e8f30 (diff) | |
download | redis-49d26a9658f7ee4a4b5d65cd71b66a4cfcccfbaa.tar.gz |
Add sleep interval to redis-cli --scan option (#3751)
Adding -i option (sleep interval) of repeat and bigkeys to redis-cli --scan.
When the keyspace contains many already expired keys scanning the
dataset with redis-cli --scan can impact the performance
Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/redis-cli.c')
-rw-r--r-- | src/redis-cli.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c index d080025b6..060f3ef66 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -1798,6 +1798,8 @@ static void usage(int err) { " -r <repeat> Execute specified command N times.\n" " -i <interval> When -r is used, waits <interval> seconds per command.\n" " It is possible to specify sub-second times like -i 0.1.\n" +" This interval is also used in --scan and --stat per cycle.\n" +" and in --bigkeys, --memkeys, and --hotkeys per 100 cycles.\n" " -n <db> Database number.\n" " -3 Start session in RESP3 protocol mode.\n" " -x Read last argument from STDIN.\n" @@ -7995,6 +7997,7 @@ static void scanMode(void) { } } freeReplyObject(reply); + if (config.interval) usleep(config.interval); } while(cur != 0); exit(0); |