mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 22:58:21 +00:00
Optimize how Stasis forwards are dispatched
This patch optimizes how forwards are dispatched in Stasis. Originally, forwards were dispatched as subscriptions that are invoked on the publishing thread. This did not account for the vast number of forwards we would end up having in the system, and the amount of work it would take to walk though the forward subscriptions. This patch modifies Stasis so that rather than walking the tree of forwards on every dispatch, when forwards and subscriptions are changed, the subscriber list for every topic in the tree is changed. This has a couple of benefits. First, this reduces the workload of dispatching messages. It also reduces contention when dispatching to different topics that happen to forward to the same aggregation topic (as happens with all of the channel, bridge and endpoint topics). Since forwards are no longer subscriptions, the bulk of this patch is simply changing stasis_subscription objects to stasis_forward objects (which, admittedly, I should have done in the first place.) Since this required me to yet again put in a growing array, I finally abstracted that out into a set of ast_vector macros in asterisk/vector.h. Review: https://reviewboard.asterisk.org/r/2883/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -10336,7 +10336,7 @@ static const struct ast_data_entry queue_data_providers[] = {
|
||||
};
|
||||
|
||||
static struct stasis_message_router *agent_router;
|
||||
static struct stasis_subscription *topic_forwarder;
|
||||
static struct stasis_forward *topic_forwarder;
|
||||
|
||||
static int unload_module(void)
|
||||
{
|
||||
@@ -10364,7 +10364,7 @@ static int unload_module(void)
|
||||
stasis_message_router_remove(message_router, queue_agent_ringnoanswer_type());
|
||||
}
|
||||
stasis_message_router_unsubscribe_and_join(agent_router);
|
||||
topic_forwarder = stasis_unsubscribe(topic_forwarder);
|
||||
topic_forwarder = stasis_forward_cancel(topic_forwarder);
|
||||
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(queue_caller_join_type);
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(queue_caller_leave_type);
|
||||
|
Reference in New Issue
Block a user