mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merge "sounds_index: Avoid repeatedly reindexing."
This commit is contained in:
@@ -4617,9 +4617,14 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
|
|||||||
check_init(init_manager(), "Asterisk Manager Interface");
|
check_init(init_manager(), "Asterisk Manager Interface");
|
||||||
check_init(ast_enum_init(), "ENUM Support");
|
check_init(ast_enum_init(), "ENUM Support");
|
||||||
check_init(ast_cc_init(), "Call Completion Supplementary Services");
|
check_init(ast_cc_init(), "Call Completion Supplementary Services");
|
||||||
check_init(ast_sounds_index_init(), "Sounds Indexer");
|
|
||||||
check_init(load_modules(0), "Module");
|
check_init(load_modules(0), "Module");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is initialized after the dynamic modules load to avoid repeatedly
|
||||||
|
* reindexing sounds for every format module load.
|
||||||
|
*/
|
||||||
|
check_init(ast_sounds_index_init(), "Sounds Indexer");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This has to load after the dynamic modules load, as items in the media
|
* This has to load after the dynamic modules load, as items in the media
|
||||||
* cache can't be constructed from items in the AstDB without their
|
* cache can't be constructed from items in the AstDB without their
|
||||||
|
@@ -285,13 +285,15 @@ static void sounds_cleanup(void)
|
|||||||
static void format_update_cb(void *data, struct stasis_subscription *sub,
|
static void format_update_cb(void *data, struct stasis_subscription *sub,
|
||||||
struct stasis_message *message)
|
struct stasis_message *message)
|
||||||
{
|
{
|
||||||
ast_sounds_reindex();
|
/* Reindexing during shutdown is pointless. */
|
||||||
|
if (!ast_shutting_down()) {
|
||||||
|
ast_sounds_reindex();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_sounds_index_init(void)
|
int ast_sounds_index_init(void)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
sounds_index = NULL;
|
|
||||||
if (ast_sounds_reindex()) {
|
if (ast_sounds_reindex()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -328,6 +330,5 @@ int ast_sounds_index_init(void)
|
|||||||
|
|
||||||
struct ast_media_index *ast_sounds_get_index(void)
|
struct ast_media_index *ast_sounds_get_index(void)
|
||||||
{
|
{
|
||||||
ao2_ref(sounds_index, +1);
|
return ao2_bump(sounds_index);
|
||||||
return sounds_index;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user