[asterisk-dev] [Code Review] Make sure the member count is correct after a reload
Terry Wilson
reviewboard at asterisk.org
Tue Oct 25 13:46:53 CDT 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1541/
-----------------------------------------------------------
(Updated Oct. 25, 2011, 1:46 p.m.)
Review request for Asterisk Developers.
Changes
-------
Despite an ominous sounding comment stating that membercount was for "logged in" members only and thus we couldn't use ao2_container_count(), I could not find a single place in the code where that seemed to be accurate. The only time we decremented membercount was when we were marking something dead or actually removing it. The only places we incremented it were either after ao2_links, or trying to correct for having set it to 0 during a reload. In every case where we were correcting the value, it seems that we are trying to make the count actually match what ao2_container_count() would return. The only place I could find where we made a determination about something being "logged in" or not, we don't trust the membercount, but instead look at devicestate, paused, etc.
This patch removes membercount, replaces its use with ao2_container_count, and (hopefully correctly) manually adds the results of ao2_container_count to a "membercount" field for ast_data queue query results. I tested the same way I did for the other patch. Everything seems to work.
Summary
-------
With the situation:
queues.conf
[test]
strategy=ringall
member => Local/queue1 at default,1
member => Local/queue2 at default,1
member => Local/queue3 at default,1
extensions.conf
[default]
exten => 100,1,Queue(test)
exten => _queueX,1,NoOp(Called ${EXTEN})
same => n,Ringing
same => n,Wait(5)
same => n,Hangup
Dialing 100 will ring all queue members. Changing the penalty of two of the members and doing a 'module reload app_queue.so' and redialing would still ring all of the members on the first try instead of just the lowest penalty member. This was because a reload would set the membercount to 0 and then only increase the membercount for *new* members and not reloaded members. Then, since the penaltymemberlimit = 0 and the membercount = 0, we ignored the penalties and would dial all members. This patch increases the member count for both reloaded and added members since we set the member count to zero on reloads anyway.
This addresses bug AST-676.
https://issues.asterisk.org/jira/browse/AST-676
Diffs (updated)
-----
/branches/1.8/apps/app_queue.c 342327
Diff: https://reviewboard.asterisk.org/r/1541/diff
Testing
-------
Fixes the above scenario.
Thanks,
Terry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111025/0a1890b7/attachment.htm>
More information about the asterisk-dev
mailing list