]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a performance regression introduced in r325483.
authorMatthew Nicholson <mnicholson@digium.com>
Wed, 19 Oct 2011 21:23:17 +0000 (21:23 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Wed, 19 Oct 2011 21:23:17 +0000 (21:23 +0000)
The regression was caused by a call to ast_parse_device_state() in app_queue's
ring_entry() function. The ast_parse_device_state() function eventually calls
ast_channel_get_full() with a channel name prefix which causes it to walk the
channel list causing massive lock contention and slow downs.

This patch fixes the regression by removing the call to
ast_parase_device_state() which should be unnecessary. Queue member device
state should be maintained by device state events. Some users have seen
instances where busy agents were called when they shouldn't have, which is the
reason the call to ast_parse_device_state() was added. That change appears to
have resolved that issue but also causes this performance regression. There may
still be issues with queue member status, and if so, alternative methods should
be investigated to resolve them.

AST-695

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@341486 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index d2ca97cb5202a6ee6b6b1a37f6ae39330579cbc1..73152acf02592f3d5a70eb142ae312c402c2568a 100644 (file)
@@ -3052,7 +3052,6 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
        char tech[256];
        char *location;
        const char *macrocontext, *macroexten;
-       enum ast_device_state newstate;
 
        /* on entry here, we know that tmp->chan == NULL */
        if (tmp->member->paused) {
@@ -3077,14 +3076,6 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
        }
 
        if (!qe->parent->ringinuse || !tmp->member->ignorebusy) {
-               if ((tmp->member->status == AST_DEVICE_UNKNOWN) || (tmp->member->status == AST_DEVICE_NOT_INUSE)) {
-                       newstate = ast_parse_device_state(tmp->member->interface);
-                       if (newstate != tmp->member->status) {
-                               ast_log(LOG_ERROR, "Found a channel matching iterface %s while status was %i changed to %i\n",
-                                       tmp->member->interface, tmp->member->status, newstate);
-                               update_status(qe->parent, tmp->member, newstate);
-                       }
-               }
                if ((tmp->member->status != AST_DEVICE_NOT_INUSE) && (tmp->member->status != AST_DEVICE_UNKNOWN)) {
                        ast_debug(1, "%s in use, can't receive call\n", tmp->interface);
                        if (qe->chan->cdr) {