X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-queued;h=8c07638b3fd66661a3b487af9242be2db6c47901;hb=4ee28b411fa819a420926b8a6e60be043fdb1d2e;hp=d4f09c18dc4c58b7138d794d81bd2ce17595895f;hpb=ca9154e5112d1f564c217fb958b3b979013b5967;p=freeside.git diff --git a/FS/bin/freeside-queued b/FS/bin/freeside-queued index d4f09c18d..8c07638b3 100644 --- a/FS/bin/freeside-queued +++ b/FS/bin/freeside-queued @@ -84,9 +84,12 @@ while (1) { my $nodepend = 'AND 0 = ( SELECT COUNT(*) FROM queue_depend'. ' WHERE queue_depend.jobnum = queue.jobnum )'; - my $order_by = "ORDER BY jobnum ". ( driver_name eq 'mysql' - ? 'LIMIT 1 FOR UPDATE' - : 'FOR UPDATE LIMIT 1' ); + #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',