Unverified Commit 94460440 authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo Committed by GitHub
Browse files

Merge pull request #5743 from AngusP/forever-repeat-cli

Redis CLI: Fix broken interval and repeat behaviour (incluing in cluster mode)
parents ed356c3a 2925bdc6
...@@ -1175,7 +1175,9 @@ static int cliSendCommand(int argc, char **argv, long repeat) { ...@@ -1175,7 +1175,9 @@ static int cliSendCommand(int argc, char **argv, long repeat) {
for (j = 0; j < argc; j++) for (j = 0; j < argc; j++)
argvlen[j] = sdslen(argv[j]); argvlen[j] = sdslen(argv[j]);
while(repeat-- > 0) { /* Negative repeat is allowed and causes infinite loop,
works well with the interval option. */
while(repeat < 0 || repeat-- > 0) {
redisAppendCommandArgv(context,argc,(const char**)argv,argvlen); redisAppendCommandArgv(context,argc,(const char**)argv,argvlen);
while (config.monitor_mode) { while (config.monitor_mode) {
if (cliReadReply(output_raw) != REDIS_OK) exit(1); if (cliReadReply(output_raw) != REDIS_OK) exit(1);
...@@ -1210,6 +1212,11 @@ static int cliSendCommand(int argc, char **argv, long repeat) { ...@@ -1210,6 +1212,11 @@ static int cliSendCommand(int argc, char **argv, long repeat) {
cliSelect(); cliSelect();
} }
} }
if (config.cluster_reissue_command){
/* If we need to reissue the command, break to prevent a
further 'repeat' number of dud interations */
break;
}
if (config.interval) usleep(config.interval); if (config.interval) usleep(config.interval);
fflush(stdout); /* Make it grep friendly */ fflush(stdout); /* Make it grep friendly */
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment