freeside/FS/bin freeside-queued,1.26.4.1,1.26.4.2
ivan
ivan at pouncequick.420.am
Fri Jun 25 03:25:12 PDT 2004
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory pouncequick:/tmp/cvs-serv1106/bin
Modified Files:
Tag: FREESIDE_1_4_BRANCH
freeside-queued
Log Message:
ping the database and retry rather before doing anything
Index: freeside-queued
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-queued,v
retrieving revision 1.26.4.1
retrieving revision 1.26.4.2
diff -u -d -r1.26.4.1 -r1.26.4.2
--- freeside-queued 28 Oct 2002 13:22:43 -0000 1.26.4.1
+++ freeside-queued 25 Jun 2004 10:25:10 -0000 1.26.4.2
@@ -7,7 +7,7 @@
use POSIX qw(:sys_wait_h setsid);
use Date::Format;
use IO::File;
-use FS::UID qw(adminsuidsetup forksuidsetup driver_name dbh);
+use FS::UID qw(adminsuidsetup forksuidsetup driver_name dbh myconnect);
use FS::Record qw(qsearch qsearchs);
use FS::queue;
use FS::queue_depend;
@@ -75,18 +75,27 @@
}
$warnkids=0;
- my $nodepend = driver_name eq 'mysql'
- ? ''
- : 'AND 0 = ( SELECT COUNT(*) FROM queue_depend'.
- ' WHERE queue_depend.jobnum = queue.jobnum ) ';
+ my $dbh = dbh;
+ unless ( $dbh->ping ) {
+ warn "WARNING: connection to database lost, reconnecting...\n";
+ myconnect;
+ unless ( $dbh->ping ) {
+ warn "WARNING: still no connection to database, sleeping for retry...\n";
+ sleep 10;
+ next;
+ }
+ }
#my($job, $ljob);
#{
# my $oldAutoCommit = $FS::UID::AutoCommit;
# local $FS::UID::AutoCommit = 0;
$FS::UID::AutoCommit = 0;
- my $dbh = dbh;
+ my $nodepend = driver_name eq 'mysql'
+ ? ''
+ : 'AND 0 = ( SELECT COUNT(*) FROM queue_depend'.
+ ' WHERE queue_depend.jobnum = queue.jobnum ) ';
my $job = qsearchs(
'queue',
{ 'status' => 'new' },
More information about the freeside-commits
mailing list