diff options
author | michael-grunder <michael.grunder@gmail.com> | 2023-03-05 12:58:45 -0800 |
---|---|---|
committer | Michael Grunder <michael.grunder@gmail.com> | 2023-03-07 17:06:35 -0800 |
commit | 011f7093c001b6584252418fc9f657c374bdca66 (patch) | |
tree | e7e034370ff0808efb1f1a59411ce21a4b77c9d7 | |
parent | e9243d4f706ab760f6c0f096d62e540ab2544c61 (diff) |
Allow specifying the keepalive interval
Fixes #1155
-rw-r--r-- | hiredis.c | 8 | ||||
-rw-r--r-- | hiredis.h | 1 |
2 files changed, 6 insertions, 3 deletions
@@ -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. */ @@ -328,6 +328,7 @@ int redisReconnect(redisContext *c); redisPushFn *redisSetPushCallback(redisContext *c, redisPushFn *fn); int redisSetTimeout(redisContext *c, const struct timeval tv); int redisEnableKeepAlive(redisContext *c); +int redisEnableKeepAliveWithInterval(redisContext *c, int interval); void redisFree(redisContext *c); redisFD redisFreeKeepFd(redisContext *c); int redisBufferRead(redisContext *c); |