Browse Source

MT#55283 safeguard against Redis connect failure

Avoids segfault is extra connection can't be established

Closes #1903

Change-Id: I6eb7315f6774015703c7ad036e08596f7f550d60
pull/1907/head
Richard Fuchs 11 months ago
parent
commit
172f389395
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      daemon/redis.c

+ 8
- 3
daemon/redis.c View File

@ -2316,9 +2316,14 @@ int redis_restore(struct redis *r, bool foreign, int db) {
mutex_init(&ctx.r_m);
g_queue_init(&ctx.r_q);
ctx.foreign = foreign;
for (int i = 0; i < rtpe_config.redis_num_threads; i++)
g_queue_push_tail(&ctx.r_q,
redis_dup(r, db));
for (int i = 0; i < rtpe_config.redis_num_threads; i++) {
struct redis *dup = redis_dup(r, db);
if (!dup) {
rlog(LOG_ERR, "Failed to create thread connection to Redis");
goto err;
}
g_queue_push_tail(&ctx.r_q, dup);
}
gtp = g_thread_pool_new(restore_thread, &ctx, rtpe_config.redis_num_threads, TRUE, NULL);
for (int i = 0; i < calls->elements; i++) {


Loading…
Cancel
Save