mirror of
https://github.com/fluencelabs/redis
synced 2025-03-20 17:40:50 +00:00
Merge pull request #5743 from AngusP/forever-repeat-cli
Redis CLI: Fix broken interval and repeat behaviour (incluing in cluster mode)
This commit is contained in:
commit
94460440b7
@ -1175,7 +1175,9 @@ static int cliSendCommand(int argc, char **argv, long repeat) {
|
||||
for (j = 0; j < argc; 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);
|
||||
while (config.monitor_mode) {
|
||||
if (cliReadReply(output_raw) != REDIS_OK) exit(1);
|
||||
@ -1210,6 +1212,11 @@ static int cliSendCommand(int argc, char **argv, long repeat) {
|
||||
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);
|
||||
fflush(stdout); /* Make it grep friendly */
|
||||
}
|
||||
@ -1603,12 +1610,12 @@ static int issueCommandRepeat(int argc, char **argv, long repeat) {
|
||||
cliPrintContextError();
|
||||
return REDIS_ERR;
|
||||
}
|
||||
}
|
||||
/* Issue the command again if we got redirected in cluster mode */
|
||||
if (config.cluster_mode && config.cluster_reissue_command) {
|
||||
}
|
||||
/* Issue the command again if we got redirected in cluster mode */
|
||||
if (config.cluster_mode && config.cluster_reissue_command) {
|
||||
cliConnect(CC_FORCE);
|
||||
} else {
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return REDIS_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user