[Asterisk-code-review] app queue: Ensure realtime members are updated if there is a... (asterisk[13])

Matt Jordan asteriskteam at digium.com
Tue Nov 24 08:56:54 CST 2015


Matt Jordan has posted comments on this change.

Change subject: app_queue: Ensure realtime members are updated if there is a call in a queue
......................................................................


Patch Set 2:

> The scenario is the following:
 > 
 > A call joins an empty queue but there aren't any agents servicing
 > the queue. After it, an agent Joins the queue (via mysql
 > database/realtime) but the agent list is never updated because
 > initially the agent list is empty. This is the real use case where
 > I found the problem.
 > 
 > If a call joins a queue where there is no agents servicing, the
 > code for the head of the queue will never run, because is_our_turn
 > will always return false, and the call will stay in wait_our_turn
 > loop until the list of available agents will be updated.
 > 
 > I think your right in two points:
 > * Is not very efficient way: Do you think should be a better way of
 > doing this?
 > * This update should be in the front of the queue: But the front
 > queue code will never run if there are no agents servicing the
 > queue when the call joins the queue.
 > 
 > I thinks this patch is a very simple way of making things work (I
 > have it working in production) but if you think there is a better
 > way of solving this problem please tell me your guidelines and I'll
 > try to make a better patch.

In is_our_turn, you

 > The scenario is the following:
 > 
 > A call joins an empty queue but there aren't any agents servicing
 > the queue. After it, an agent Joins the queue (via mysql
 > database/realtime) but the agent list is never updated because
 > initially the agent list is empty. This is the real use case where
 > I found the problem.
 > 
 > If a call joins a queue where there is no agents servicing, the
 > code for the head of the queue will never run, because is_our_turn
 > will always return false, and the call will stay in wait_our_turn
 > loop until the list of available agents will be updated.
 > 
 > I think your right in two points:
 > * Is not very efficient way: Do you think should be a better way of
 > doing this?
 > * This update should be in the front of the queue: But the front
 > queue code will never run if there are no agents servicing the
 > queue when the call joins the queue.
 > 
 > I thinks this patch is a very simple way of making things work (I
 > have it working in production) but if you think there is a better
 > way of solving this problem please tell me your guidelines and I'll
 > try to make a better patch.

Based on that description, then in is_our_turn, if num_available_members is 0 and qe->pos == 1, then we should go refresh the queue members and check again.

static int is_our_turn(struct queue_ent *qe)
{
...

    if (avl == 0 && qe->pos == 1) {
        update_realtime_members(qe->parent);
    }
    
}

If realtime members are available, you'll catch it on the next pass through that calls is_our_turn. You'll also only check the database if:
 * The caller is at the head of the queue, waiting
 * There are no members initially

Which matches your scenario.

-- 
To view, visit https://gerrit.asterisk.org/1694
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: If1e036d013a5c1d8b0bf60d71d48fe98694a8682
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Carlos Oliva <carlos.oliva at invoxcontact.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Carlos Oliva <carlos.oliva at invoxcontact.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-HasComments: No



More information about the asterisk-code-review mailing list