MT#55283 shortcut for empty Redis restores

Don't launch a bunch of threads to do nothing if we know that there's
nothing to restore.

Change-Id: I681af675f38cc42c2c48c6d8ec4da5421b7c47ba
pull/1611/head
Richard Fuchs 3 years ago
parent 4d708350ee
commit 18595419b4

@ -2187,6 +2187,9 @@ int redis_restore(struct redis *r, bool foreign, int db) {
goto err;
}
if (calls->elements == 0)
goto out;
mutex_init(&ctx.r_m);
g_queue_init(&ctx.r_q);
ctx.foreign = foreign;
@ -2209,6 +2212,8 @@ int redis_restore(struct redis *r, bool foreign, int db) {
g_thread_pool_free(gtp, FALSE, TRUE);
while ((r = g_queue_pop_head(&ctx.r_q)))
redis_close(r);
out:
ret = 0;
freeReplyObject(calls);

Loading…
Cancel
Save