From 011f7093c001b6584252418fc9f657c374bdca66 Mon Sep 17 00:00:00 2001 From: michael-grunder Date: Sun, 5 Mar 2023 12:58:45 -0800 Subject: Allow specifying the keepalive interval Fixes #1155 --- hiredis.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'hiredis.c') diff --git a/hiredis.c b/hiredis.c index 55df883..26e1ed6 100644 --- a/hiredis.c +++ b/hiredis.c @@ -942,11 +942,13 @@ int redisSetTimeout(redisContext *c, const struct timeval tv) { return REDIS_ERR; } +int redisEnableKeepAliveWithInterval(redisContext *c, int interval) { + return redisKeepAlive(c, interval); +} + /* Enable connection KeepAlive. */ int redisEnableKeepAlive(redisContext *c) { - if (redisKeepAlive(c, REDIS_KEEPALIVE_INTERVAL) != REDIS_OK) - return REDIS_ERR; - return REDIS_OK; + return redisKeepAlive(c, REDIS_KEEPALIVE_INTERVAL); } /* Set a user provided RESP3 PUSH handler and return any old one set. */ -- cgit v1.2.3