From 0150db364d939a5a69244aca6a66ad05903979fe Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Tue, 19 May 2009 22:36:11 -0700 Subject: [PATCH 1/1] Allow timeout=0 config to disable client timeouts --- redis.c | 4 ++-- redis.conf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/redis.c b/redis.c index 9587dcdc..f4e15bb4 100644 --- a/redis.c +++ b/redis.c @@ -720,7 +720,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { } /* Close connections of timedout clients */ - if (!(loops % 10)) + if (server.maxidletime && !(loops % 10)) closeTimedoutClients(); /* Check if a background saving in progress terminated */ @@ -959,7 +959,7 @@ static void loadServerConfig(char *filename) { /* Execute config directives */ if (!strcasecmp(argv[0],"timeout") && argc == 2) { server.maxidletime = atoi(argv[1]); - if (server.maxidletime < 1) { + if (server.maxidletime < 0) { err = "Invalid timeout value"; goto loaderr; } } else if (!strcasecmp(argv[0],"port") && argc == 2) { diff --git a/redis.conf b/redis.conf index 38592b02..e8c6cd82 100644 --- a/redis.conf +++ b/redis.conf @@ -16,7 +16,7 @@ port 6379 # # bind 127.0.0.1 -# Close the connection after a client is idle for N seconds +# Close the connection after a client is idle for N seconds (0 to disable) timeout 300 # Save the DB on disk: -- 2.45.2