mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
Configuration for Stasis threadpool
The appropriate settings for the Stasis threadpool is very system specific, depending upon both workload and system configuration. This patch adds a stasis.conf file which can be used to configure the key attributes of the threadpool for the Stasis message bus. (closes issue ASTERISK-21280) Review: https://reviewboard.asterisk.org/r/2651/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -642,24 +642,25 @@ int stasis_init(void)
|
||||
{
|
||||
int cache_init;
|
||||
|
||||
/* XXX Should this be configurable? */
|
||||
struct ast_threadpool_options opts = {
|
||||
.version = AST_THREADPOOL_OPTIONS_VERSION,
|
||||
.idle_timeout = 20,
|
||||
.auto_increment = 1,
|
||||
.initial_size = 0,
|
||||
.max_size = 200
|
||||
};
|
||||
struct ast_threadpool_options opts;
|
||||
|
||||
/* Be sure the types are cleaned up after the message bus */
|
||||
ast_register_cleanup(stasis_cleanup);
|
||||
ast_register_atexit(stasis_exit);
|
||||
|
||||
if (stasis_config_init() != 0) {
|
||||
ast_log(LOG_ERROR, "Stasis configuration failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pool) {
|
||||
ast_log(LOG_ERROR, "Stasis double-initialized\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
stasis_config_get_threadpool_options(&opts);
|
||||
ast_debug(3, "Creating Stasis threadpool: initial_size = %d, max_size = %d, idle_timeout_secs = %d\n",
|
||||
opts.initial_size, opts.max_size, opts.idle_timeout);
|
||||
pool = ast_threadpool_create("stasis-core", NULL, &opts);
|
||||
if (!pool) {
|
||||
ast_log(LOG_ERROR, "Stasis threadpool allocation failed\n");
|
||||
|
Reference in New Issue
Block a user