summaryrefslogtreecommitdiff
path: root/main/sorcery.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2016-06-02 18:19:13 -0500
committerRichard Mudgett <rmudgett@digium.com>2016-06-09 10:32:07 -0500
commit4879cd875c932817c8259934814dd18cf15f5a1c (patch)
tree3fe532f547ee0b170cd0f1e293d5ed20d91fb2fe /main/sorcery.c
parent2cd67d5b07d28891ea7c86aece702a4d6e436afc (diff)
sorcery: Add setting object type congestion levels.
Sorcery creates taskprocessors for object types to process object observer callbacks. An API call is needed to be able to set the congestion levels of these taskprocessors for selected object types. * Updated PJSIP's contact and contact_status sorcery object type observer default congestion levels based upon stress testing. Increased the congestion levels to reduce the potential for bursty register/unregister and subscribe/unsubscribe activity from triggering the taskprocessor overload alert. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I4542e83b556f0714009bfeff89505c801f1218c6
Diffstat (limited to 'main/sorcery.c')
-rw-r--r--main/sorcery.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/main/sorcery.c b/main/sorcery.c
index ec340e827..6a7b54bbf 100644
--- a/main/sorcery.c
+++ b/main/sorcery.c
@@ -1164,6 +1164,20 @@ int __ast_sorcery_object_register(struct ast_sorcery *sorcery, const char *type,
return 0;
}
+int ast_sorcery_object_set_congestion_levels(struct ast_sorcery *sorcery, const char *type, long low_water, long high_water)
+{
+ struct ast_sorcery_object_type *object_type;
+ int res = -1;
+
+ object_type = ao2_find(sorcery->types, type, OBJ_SEARCH_KEY);
+ if (object_type) {
+ res = ast_taskprocessor_alert_set_levels(object_type->serializer,
+ low_water, high_water);
+ ao2_ref(object_type, -1);
+ }
+ return res;
+}
+
void ast_sorcery_object_set_copy_handler(struct ast_sorcery *sorcery, const char *type, sorcery_copy_handler copy)
{
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);