[freeside-commits] freeside/FS/bin freeside-queued, 1.35.2.2, 1.35.2.3
Ivan,,,
ivan at wavetail.420.am
Fri Apr 17 12:50:23 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail.420.am:/tmp/cvs-serv29135/FS/bin
Modified Files:
Tag: FREESIDE_1_7_BRANCH
freeside-queued
Log Message:
add priority to job queue so billing jobs don't don't drown out provisioning jobs
Index: freeside-queued
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-queued,v
retrieving revision 1.35.2.2
retrieving revision 1.35.2.3
diff -u -d -r1.35.2.2 -r1.35.2.3
--- freeside-queued 18 Apr 2007 23:23:09 -0000 1.35.2.2
+++ freeside-queued 17 Apr 2009 19:50:21 -0000 1.35.2.3
@@ -89,14 +89,19 @@
my $nodepend = 'AND 0 = ( SELECT COUNT(*) FROM queue_depend'.
' WHERE queue_depend.jobnum = queue.jobnum ) ';
- my $job = qsearchs(
- 'queue',
- { 'status' => 'new' },
- '',
- driver_name eq 'mysql'
- ? "$nodepend ORDER BY jobnum LIMIT 1 FOR UPDATE"
- : "$nodepend ORDER BY jobnum FOR UPDATE LIMIT 1"
- ) or do {
+ #anything with a priority goes after stuff without one
+ my $order_by = ' ORDER BY COALESCE(priority,0) ASC, jobnum ASC ';
+
+ $order_by .= ( driver_name eq 'mysql'
+ ? ' LIMIT 1 FOR UPDATE '
+ : ' FOR UPDATE LIMIT 1 ' );
+
+ my $job = qsearchs({
+ 'table' => 'queue',
+ 'hashref' => { 'status' => 'new' },
+ 'extra_sql' => $nodepend,
+ 'order_by' => $order_by,
+ }) or do {
# if $oldAutoCommit {
dbh->commit or do {
warn "WARNING: database error, closing connection: ". dbh->errstr;
More information about the freeside-commits
mailing list