diff options
author | David M. Lee <dlee@digium.com> | 2013-07-03 17:20:43 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-07-03 17:20:43 +0000 |
commit | c4adaf91067559dd5aa90577e181693abade0602 (patch) | |
tree | 0570531e9eff80030bb9a3a00ee68cee66993766 /main/stasis.c | |
parent | 9ba976b19c3e553b8ff0715b20894de61520a300 (diff) |
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
Diffstat (limited to 'main/stasis.c')
-rw-r--r-- | main/stasis.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/main/stasis.c b/main/stasis.c index 406a1bb25..64f77e309 100644 --- a/main/stasis.c +++ b/main/stasis.c @@ -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"); |