Skip to content

Commit

Permalink
Revert "dialog: load dialogs on child init"
Browse files Browse the repository at this point in the history
This reverts commit 3ddae43.
  • Loading branch information
razvancrainea committed Aug 22, 2019
1 parent 527f718 commit cf48b8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
8 changes: 0 additions & 8 deletions modules/dialog/dialog.c
Expand Up @@ -909,10 +909,6 @@ static int mod_init(void)



static void rpc_load_dlg_db(int sender, void *param)
{
load_dlg_db(dlg_hash_size);
}

static int child_init(int rank)
{
Expand All @@ -925,10 +921,6 @@ static int child_init(int rank)
LM_ERR("failed to connect to database (rank=%d)\n",rank);
return -1;
}
if (rank == 1 && ipc_dispatch_rpc(rpc_load_dlg_db, NULL) < 0) {
LM_CRIT("failed to RPC the dialogs loading\n");
return -1;
}
}

if (cdb_url.s && cdb_url.len && init_cachedb() < 0) {
Expand Down
24 changes: 12 additions & 12 deletions modules/dialog/dlg_db_handler.c
Expand Up @@ -184,9 +184,6 @@ int init_dlg_db(const str *db_url, int dlg_hash_size , int db_update_period)
return -1;
}

dialog_dbf.close(dialog_db_handle);
dialog_db_handle = 0;

if (dlg_db_mode == DB_MODE_DELAYED) {
if (register_timer("dlg-dbupdate",dialog_update_db,
(void*)(unsigned long)1 /*do locking*/,
Expand All @@ -196,16 +193,19 @@ int init_dlg_db(const str *db_url, int dlg_hash_size , int db_update_period)
}
}

return 0;
}

void load_dlg_db(int dlg_hash_size)
{
if( (load_dialog_info_from_db(dlg_hash_size) ) ==0 ){
if (dlg_db_mode==DB_MODE_SHUTDOWN && remove_all_dialogs_from_db()!=0)
LM_WARN("failed to properly remove all the dialogs form DB\n");
} else
if( (load_dialog_info_from_db(dlg_hash_size) ) !=0 ){
LM_ERR("unable to load the dialog data\n");
return -1;
}

if (dlg_db_mode==DB_MODE_SHUTDOWN && remove_all_dialogs_from_db()!=0) {
LM_WARN("failed to properly remove all the dialogs form DB\n");
}

dialog_dbf.close(dialog_db_handle);
dialog_db_handle = 0;

return 0;
}


Expand Down
1 change: 0 additions & 1 deletion modules/dialog/dlg_db_handler.h
Expand Up @@ -104,7 +104,6 @@ extern int db_flush_vp;

#define should_remove_dlg_db() (dlg_db_mode==DB_MODE_REALTIME)

void load_dlg_db(int dlg_hash_size);
int init_dlg_db(const str *db_url, int dlg_hash_size, int db_update_period);
int dlg_connect_db(const str *db_url);
void destroy_dlg_db();
Expand Down

0 comments on commit cf48b8f

Please sign in to comment.