[freeside-commits] freeside/FS/bin freeside-queued, 1.38, 1.39 freeside-cdrd, 1.4, 1.5
Ivan,,,
ivan at wavetail.420.am
Sun Jan 25 12:43:16 PST 2009
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail.420.am:/tmp/cvs-serv11132
Modified Files:
freeside-queued freeside-cdrd
Log Message:
reduce waiting time for -cdrd and -queued, RT#4667
Index: freeside-queued
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-queued,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- freeside-queued 9 Nov 2008 08:51:01 -0000 1.38
+++ freeside-queued 25 Jan 2009 20:43:14 -0000 1.39
@@ -81,22 +81,19 @@
# local $FS::UID::AutoCommit = 0;
$FS::UID::AutoCommit = 0;
- #assuming mysql 4.1 w/subqueries now
- #my $nodepend = driver_name eq 'mysql'
- # ? ''
- # : 'AND 0 = ( SELECT COUNT(*) FROM queue_depend'.
- # ' WHERE queue_depend.jobnum = queue.jobnum ) ';
my $nodepend = 'AND 0 = ( SELECT COUNT(*) FROM queue_depend'.
- ' WHERE queue_depend.jobnum = queue.jobnum ) ';
+ ' 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 {
+ my $order_by = "ORDER BY jobnum ". ( 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;
@@ -104,18 +101,10 @@
next;
};
# }
- sleep 5; #connecting to db is expensive
+ sleep 1;
next;
};
- #assuming mysql 4.1 w/subqueries now
- #if ( driver_name eq 'mysql'
- # && qsearch('queue_depend', { 'jobnum' => $job->jobnum } ) ) {
- # dbh->commit or die dbh->errstr; #if $oldAutoCommit;
- # sleep 5; #would be better if mysql could do everything in query above
- # next;
- #}
-
my %hash = $job->hash;
$hash{'status'} = 'locked';
my $ljob = new FS::queue ( \%hash );
Index: freeside-cdrd
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-cdrd,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- freeside-cdrd 21 Dec 2008 18:38:12 -0000 1.4
+++ freeside-cdrd 25 Jan 2009 20:43:14 -0000 1.5
@@ -108,7 +108,7 @@
}
myexit() if sigterm() || sigint();
- sleep 5; # unless $found;
+ sleep 1 unless $found;
}
More information about the freeside-commits
mailing list