Skip to content

Commit a8a311b

Browse files
committed
return RECONNECT on connection failure. Fixes #5651
1 parent 036d8bf commit a8a311b

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ static cache_status_t cache_entry_find(rlm_cache_entry_t **out, UNUSED rlm_cache
208208

209209
reply = redisCommand(randle->conn,"GET %s", key);
210210
if (!reply) {
211-
RERROR("Failed retrieving entry for key \"%s\"", key);
212-
return CACHE_ERROR;
211+
RERROR("Failed talking to database for key \"%s\"", key);
212+
return CACHE_RECONNECT;
213213
}
214214

215215
c = talloc_zero(NULL, rlm_cache_entry_t);
@@ -279,7 +279,10 @@ static cache_status_t cache_entry_insert(UNUSED rlm_cache_t *inst, REQUEST *requ
279279
c->expires - c->created);
280280

281281
if (!reply) {
282-
goto error;
282+
RERROR("Failed talking to database for key \"%s\"", c->key);
283+
if (reply) freeReplyObject(reply);
284+
talloc_free(pool);
285+
return CACHE_RECONNECT;
283286
}
284287

285288
switch (reply->type) {
@@ -316,15 +319,16 @@ static cache_status_t cache_entry_expire(UNUSED rlm_cache_t *inst, REQUEST *requ
316319
reply = redisCommand( randle->conn, "DEL %b", c->key, talloc_array_length(c->key) - 1);
317320
if (!reply) {
318321
RERROR("Failed expire for key \"%s\"", c->key);
319-
error:
320322
if (reply) freeReplyObject(reply);
321-
return CACHE_ERROR;
323+
return CACHE_RECONNECT;
322324
}
323325

324326
switch (reply->type) {
325327
default:
326328
RERROR("Failed expire for key \"%s\"", c->key);
327-
goto error;
329+
error:
330+
if (reply) freeReplyObject(reply);
331+
return CACHE_ERROR;
328332
case REDIS_REPLY_ERROR:
329333
RERROR("Failed expire for key \"%s\": %s", c->key, reply->str);
330334
goto error;

0 commit comments

Comments
 (0)