[svn-commits] mmichelson: trunk r89070 - in /trunk: ./ apps/ configs/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Nov 6 16:36:55 CST 2007
Author: mmichelson
Date: Tue Nov 6 16:36:55 2007
New Revision: 89070
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89070
Log:
Adding the queue strategy wrandom
(closes issue #10942, reported and patched by julianjm, documentation changes by me)
Modified:
trunk/CHANGES
trunk/apps/app_queue.c
trunk/configs/queues.conf.sample
Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=89070&r1=89069&r2=89070
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Tue Nov 6 16:36:55 2007
@@ -166,6 +166,7 @@
queue log.
* Added ability for non-realtime queues to have realtime members
* Added the "linear" strategy to queues.
+ * Added the "wrandom" strategy to queues.
MeetMe Changes
--------------
Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=89070&r1=89069&r2=89070
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Tue Nov 6 16:36:55 2007
@@ -101,7 +101,8 @@
QUEUE_STRATEGY_FEWESTCALLS,
QUEUE_STRATEGY_RANDOM,
QUEUE_STRATEGY_RRMEMORY,
- QUEUE_STRATEGY_LINEAR
+ QUEUE_STRATEGY_LINEAR,
+ QUEUE_STRATEGY_WRANDOM
};
static struct strategy {
@@ -114,6 +115,7 @@
{ QUEUE_STRATEGY_RANDOM, "random" },
{ QUEUE_STRATEGY_RRMEMORY, "rrmemory" },
{ QUEUE_STRATEGY_LINEAR, "linear" },
+ { QUEUE_STRATEGY_WRANDOM, "wrandom"},
};
#define DEFAULT_RETRY 5
@@ -2597,6 +2599,9 @@
tmp->metric = ast_random() % 1000;
tmp->metric += mem->penalty * 1000000;
break;
+ case QUEUE_STRATEGY_WRANDOM:
+ tmp->metric = ast_random() % ((1 + mem->penalty) * 1000);
+ break;
case QUEUE_STRATEGY_FEWESTCALLS:
tmp->metric = mem->calls;
tmp->metric += mem->penalty * 1000000;
Modified: trunk/configs/queues.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/queues.conf.sample?view=diff&rev=89070&r1=89069&r2=89070
==============================================================================
--- trunk/configs/queues.conf.sample (original)
+++ trunk/configs/queues.conf.sample Tue Nov 6 16:36:55 2007
@@ -96,6 +96,13 @@
; linear - rings interfaces in the order specified in this configuration file.
; If you use dynamic members, the members will be rung in the order in
; which they were added
+; wrandom - rings random interface, but uses the member's penalty as a weight
+; when calculating their metric. So a member with penalty 0 will have
+; a metric somewhere between 0 and 1000, and a member with penalty 1 will
+; have a metric between 0 and 2000, and a member with penalty 2 will have
+; a metric between 0 and 3000. Please note, if using this strategy, the member
+; penalty is not the same as when using other queue strategies. It is ONLY used
+; as a weight for calculating metric.
;
;strategy = ringall
;
More information about the svn-commits
mailing list