From 50786b4d9e92e76dc9af3f18e9ba70d4223e9524 Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Fri, 13 Sep 2024 12:11:04 +0300 Subject: [PATCH] dialplan: create DB connection from all workers This allows modules, such as mi_script, to run reload commands inline, and not through a dedicated MI process. (cherry picked from commit 9a3caeca760ec90f6bf5eaac44eff98923106f4d) --- modules/dialplan/dialplan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/dialplan/dialplan.c b/modules/dialplan/dialplan.c index 8c008d78e55..c33c1d554e1 100644 --- a/modules/dialplan/dialplan.c +++ b/modules/dialplan/dialplan.c @@ -420,10 +420,6 @@ static int child_init(int rank) { dp_connection_list_p el; - /* only process with rank 1 loads data */ - if (rank != 1) - return 0; - /* Connect to DBs.... */ for(el = dp_conns; el; el = el->next){ if (dp_connect_db(el) != 0) { @@ -433,6 +429,10 @@ static int child_init(int rank) } } + /* only process with rank 1 loads data */ + if (rank != 1) + return 0; + /* ...and fire the RPC to perform the data load in the * same process, but after child_init is done */ if (ipc_send_rpc( process_no, dp_rpc_data_load, NULL)<0) {