projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
modify invoice DID summary date range calculation, RT10886
[freeside.git]
/
FS
/
bin
/
freeside-torrus-srvderive
diff --git
a/FS/bin/freeside-torrus-srvderive
b/FS/bin/freeside-torrus-srvderive
index
7a42f51
..
3985601
100644
(file)
--- a/
FS/bin/freeside-torrus-srvderive
+++ b/
FS/bin/freeside-torrus-srvderive
@@
-59,20
+59,23
@@
my $sql = "
my $orderlimit = "
ORDER BY srv_date, srv_time
my $orderlimit = "
ORDER BY srv_date, srv_time
- LIMIT
5
0
-";
+ LIMIT
10
0
+";
#50?
our $kids = 0;
our $kids = 0;
-MAIN: while (1) {
+#MAIN: while (1) {
+while (1) {
my $found = 0;
my $found = 0;
- SERVICEID: foreach my $torrus_srvderive ( qsearch('torrus_srvderive', {}) ) {
+ #SERVICEID: foreach my $torrus_srvderive ( qsearch('torrus_srvderive', {}) ) {
+ foreach my $torrus_srvderive ( qsearch('torrus_srvderive', {}) ) {
&reap_kids;
if ( $kids >= $max_kids ) {
&reap_kids;
if ( $kids >= $max_kids ) {
- sleep 10;
+ sleep 5;
+ myexit() if sigterm() || sigint();
redo;
}
redo;
}
@@
-95,7
+98,11
@@
MAIN: while (1) {
my $serviceid = $torrus_srvderive->serviceid;
my @serviceids = $torrus_srvderive->component_serviceids;
my $serviceid = $torrus_srvderive->serviceid;
my @serviceids = $torrus_srvderive->component_serviceids;
- next unless @serviceids; #don't try to search for empty virtual ports
+ exit unless @serviceids; #don't try to search for empty virtual ports
+
+ #nonlocking select statements; rows in this table never change
+ dbh->do('SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED')
+ if driver_name eq 'mysql';
my @in = ();
for my $dir ('_IN', '_OUT') {
my @in = ();
for my $dir ('_IN', '_OUT') {
@@
-118,7
+125,7
@@
MAIN: while (1) {
die $error if $error;
} else {
warn "no initial last_srv_date for $serviceid; skipping\n" if $DEBUG;
die $error if $error;
} else {
warn "no initial last_srv_date for $serviceid; skipping\n" if $DEBUG;
-
nex
t;
+
exi
t;
}
}
}
}
@@
-142,24
+149,26
@@
MAIN: while (1) {
eval {
my $h = set_sig_handler( 'ALRM', sub { die "_timeout\n"; } );
eval {
my $h = set_sig_handler( 'ALRM', sub { die "_timeout\n"; } );
- alarm(1
0
*60); #5*60); #$torrus_srvderive->last_srv_date ? 5*60 : 15*60);
+ alarm(1
5
*60); #5*60); #$torrus_srvderive->last_srv_date ? 5*60 : 15*60);
$sth->execute($serviceid, $serviceid) or die $sth->errstr;
alarm(0);
};
alarm(0);
if ( $@ && $@ eq "_timeout\n" ) {
$sth->execute($serviceid, $serviceid) or die $sth->errstr;
alarm(0);
};
alarm(0);
if ( $@ && $@ eq "_timeout\n" ) {
- warn "search timed out; reconnecting and restarting\n";
+ #warn "search timed out; reconnecting and restarting\n";
+ warn "search timed out\n";
dbh->clone()->do("KILL QUERY ". dbh->{"mysql_thread_id"})
if driver_name eq 'mysql';
dbh->rollback; #or die dbh->errstr;
dbh->clone()->do("KILL QUERY ". dbh->{"mysql_thread_id"})
if driver_name eq 'mysql';
dbh->rollback; #or die dbh->errstr;
- adminsuidsetup($user);
- next SERVICEID; #MAIN;
+ #adminsuidsetup($user);
+ #next SERVICEID; #MAIN;
+ exit;
} elsif ( $@ ) {
die $@;
}
} elsif ( $@ ) {
die $@;
}
- warn "search finished; checking results\n" if $DEBUG;
+ warn "search f
or $serviceid f
inished; checking results\n" if $DEBUG;
my $prev = 0;
while ( my $row = $sth->fetchrow_arrayref ) {
my $prev = 0;
while ( my $row = $sth->fetchrow_arrayref ) {
@@
-200,11
+209,13
@@
MAIN: while (1) {
#stupid mysql deadlocks all the time on insert, so we need to recover
unless ( $isth->execute(@param) ) {
#stupid mysql deadlocks all the time on insert, so we need to recover
unless ( $isth->execute(@param) ) {
- warn "Error inserting data for $serviceid$dir (restarting): ".
- $isth->errstr;
+ #warn "Error inserting data for $serviceid$dir (restarting): ".
+ # $isth->errstr;
+ warn "Error inserting data for $serviceid$dir: ". $isth->errstr;
dbh->rollback; #or die dbh->errstr;
dbh->rollback; #or die dbh->errstr;
- sleep 5;
- next SERVICEID; #MAIN;
+ #sleep 5;
+ #next SERVICEID; #MAIN;
+ exit;
}
}
}
}
@@
-230,7
+241,7
@@
MAIN: while (1) {
myexit() if sigterm() || sigint();
warn "restarting main loop\n" if $DEBUG > 1;
myexit() if sigterm() || sigint();
warn "restarting main loop\n" if $DEBUG > 1;
- sleep 60 unless $found;
+
#
sleep 60 unless $found;
}
sub _shouldrun {
}
sub _shouldrun {