summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-07-22 17:37:06 -0400
committerRichard Mudgett <rmudgett@digium.com>2016-08-03 14:56:45 -0500
commitea71bd6e3e17bc43b006400c25cce281dd0f6897 (patch)
tree49b829ee33ab6a5074317a630cd7c64a081e47aa /apps
parent8d6a7b89bd663fe87c64bd49a41450851ea3d928 (diff)
app_voicemail: Add taskprocessor alert level options.
On heavy loaded system with IMAP or DB storage, 'app_voicemail' taskprocessor queue could reach 500 scheduled tasks. It could happen when the IMAP or DB server dies or is unreachable. It could happen on startup when there are many (thousands) realtime endpoints configured with unsolicited mwi. If the taskprocessor queue reaches the high water level then the alert is triggered and pjsip stops processing new requests until the queue reaches the low water level to clear the alert. This patch adds 2 new 'general' configuration options to tune taskprocessor alert levels: 'tps_queue_high' - Taskprocessor high water alert trigger level. 'tps_queue_low' - Taskprocessor low water clear alert level ASTERISK-26229 #close Change-Id: I766294fbffedf64053c0d9ac0bedd3109f043ee8
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 321e5c9c0..5eb767c1c 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -13453,6 +13453,8 @@ static int actual_load_config(int reload, struct ast_config *cfg, struct ast_con
int x;
unsigned int tmpadsi[4];
char secretfn[PATH_MAX] = "";
+ long tps_queue_low;
+ long tps_queue_high;
#ifdef IMAP_STORAGE
ast_copy_string(imapparentfolder, "\0", sizeof(imapparentfolder));
@@ -14028,6 +14030,25 @@ static int actual_load_config(int reload, struct ast_config *cfg, struct ast_con
pagerbody = ast_strdup(substitute_escapes(val));
}
+ tps_queue_high = AST_TASKPROCESSOR_HIGH_WATER_LEVEL;
+ if ((val = ast_variable_retrieve(cfg, "general", "tps_queue_high"))) {
+ if (sscanf(val, "%30ld", &tps_queue_high) != 1 || tps_queue_high <= 0) {
+ ast_log(AST_LOG_WARNING, "Invalid the taskprocessor high water alert trigger level '%s'\n", val);
+ tps_queue_high = AST_TASKPROCESSOR_HIGH_WATER_LEVEL;
+ }
+ }
+ tps_queue_low = -1;
+ if ((val = ast_variable_retrieve(cfg, "general", "tps_queue_low"))) {
+ if (sscanf(val, "%30ld", &tps_queue_low) != 1 ||
+ tps_queue_low < -1 || tps_queue_high < tps_queue_low) {
+ ast_log(AST_LOG_WARNING, "Invalid the taskprocessor low water clear alert level '%s'\n", val);
+ tps_queue_low = -1;
+ }
+ }
+ if (ast_taskprocessor_alert_set_levels(mwi_subscription_tps, tps_queue_low, tps_queue_high)) {
+ ast_log(AST_LOG_WARNING, "Failed to set alert levels for voicemail taskprocessor.\n");
+ }
+
/* load mailboxes from users.conf */
if (ucfg) {
for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {