Permalink
Browse files

Exit immediately when there only are idling connections

  • Loading branch information...
pietern committed Feb 21, 2011
1 parent ea2e7f3 commit c8016b93e7599b7a24f7169009ce929bc18c3013
Showing with 11 additions and 7 deletions.
  1. +11 −7 redis-load.c
View
@@ -276,7 +276,7 @@ static void issueRequest(client c) {
c->reqtype = op;
if (op == REDIS_IDLE) {
- printf("idle!\n");
+ /* Idle */
} else if (op == REDIS_SET) {
datalen = randomData(key);
redisAsyncCommand(c->context,handleReply,NULL,"SET string:%ld %b",key,config.databuf,datalen);
@@ -500,13 +500,17 @@ static void parseOptions(int argc, char **argv) {
static void ctrlc(int sig) {
REDIS_NOTUSED(sig);
- config.ctrlc++;
- if (config.ctrlc == 1) {
- config.done = 1;
- printf("\nWaiting for pending requests to complete...\n");
- } else {
- printf("\nForcing exit...\n");
+ if (config.idlemode) {
exit(1);
+ } else {
+ config.ctrlc++;
+ if (config.ctrlc == 1) {
+ config.done = 1;
+ printf("\nWaiting for pending requests to complete...\n");
+ } else {
+ printf("\nForcing exit...\n");
+ exit(1);
+ }
}
}

0 comments on commit c8016b9

Please sign in to comment.