summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-02-27 19:39:26 +0000
committerivan <ivan>2011-02-27 19:39:26 +0000
commita1ce0a0f20a5f17aa4b365969fbcfb4fd92802b8 (patch)
treefe3a5b029c3fa52eba5d98d723c3e00c7a03674a
parentc1c95913cd4d5970e31649d5086548e7a71489d1 (diff)
add start of torrus srvderive daemon, RT#10574
-rw-r--r--FS/bin/freeside-torrus-srvderive3
1 files changed, 2 insertions, 1 deletions
diff --git a/FS/bin/freeside-torrus-srvderive b/FS/bin/freeside-torrus-srvderive
index b6450164f..516df5518 100644
--- a/FS/bin/freeside-torrus-srvderive
+++ b/FS/bin/freeside-torrus-srvderive
@@ -71,6 +71,7 @@ while (1) {
my( $srv_date, $srv_time ) = @$row;
my $cur = str2time( "$srv_date $srv_time" );
next if $cur-$prev <= 60;
+ last if time - $cur <= 300;
warn "no $serviceid for $srv_date $srv_time; adding\n"
if $DEBUG;
@@ -82,7 +83,7 @@ while (1) {
my $sin = join(',', map dbh->quote("$_$dir"), @serviceids);
my $sum = "
- SELECT SUM(value) FROM srvexport AS other
+ SELECT COALESCE(SUM(value),0) FROM srvexport AS other
WHERE other.serviceid IN ($sin)
AND ABS( $cur - $other_date ) <= 60
";