[asterisk-commits] mmichelson: branch mmichelson/queue-penalty r93762 - /team/mmichelson/queue-p...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 18 16:24:26 CST 2007


Author: mmichelson
Date: Tue Dec 18 16:24:25 2007
New Revision: 93762

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93762
Log:
Changed the if to a while when checking if we should move to the next penalty rule. The reason for this is
if enough time has elapsed to actually move ahead by more than one rule, we should do that. This sort of thing
should actually only happen to the head caller (or callers if using autofill) of the queue, but for consistency's sake
(or if someone's periodic announcement is really long) I've added the same thing for other callers as well.

I also added a similar temporary debug statement to wait_our_turn that I added to queue_exec.

At this point, I have done basic tests to make sure the penalty gets changed as desired and that changing the penalty
has the desired effect. It's now time to move on to more complicated issues, like what happens on a reload...


Modified:
    team/mmichelson/queue-penalty/apps/app_queue.c

Modified: team/mmichelson/queue-penalty/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-penalty/apps/app_queue.c?view=diff&rev=93762&r1=93761&r2=93762
==============================================================================
--- team/mmichelson/queue-penalty/apps/app_queue.c (original)
+++ team/mmichelson/queue-penalty/apps/app_queue.c Tue Dec 18 16:24:25 2007
@@ -2624,13 +2624,14 @@
 			break;
 		
 		/* see if we need to move to the next penalty level for this queue */
-		if (qe->pr && ((time(NULL) - qe->start) > qe->pr->time)) {
+		while (qe->pr && ((time(NULL) - qe->start) > qe->pr->time)) {
 			int max_penalty = qe->pr->relative ? qe->max_penalty + qe->pr->value : qe->pr->value;
 			char max_penalty_str[12]; /*XXX Will change this idiom and probably optimize things once everything is running */
 			snprintf(max_penalty_str, sizeof(max_penalty_str) - 1, "%d", max_penalty);
 			AST_LIST_LOCK(&qe->parent->rules);
 			pbx_builtin_setvar_helper(qe->chan, "QUEUE_MAX_PENALTY", max_penalty_str);
 			qe->max_penalty = max_penalty;
+			ast_log(LOG_DEBUG, "Set max penalty for caller %s to %d\n", qe->chan->name, qe->max_penalty);
 			qe->pr = AST_LIST_NEXT(qe->pr, list);
 			AST_LIST_UNLOCK(&qe->parent->rules);
 		}
@@ -4220,7 +4221,7 @@
 			}
 
 			/* see if we need to move to the next penalty level for this queue */
-			if (qe.pr && ((time(NULL) - qe.start) > qe.pr->time)) {
+			while (qe.pr && ((time(NULL) - qe.start) > qe.pr->time)) {
 				char max_penalty_str[12]; /*XXX Will change this idiom and probably optimize things once everything is running */
 				max_penalty = qe.pr->relative ? qe.max_penalty + qe.pr->value : qe.pr->value;
 				snprintf(max_penalty_str, sizeof(max_penalty_str) - 1, "%d", max_penalty);




More information about the asterisk-commits mailing list