projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c1c9591
)
add start of torrus srvderive daemon, RT#10574
author
ivan
<ivan>
Sun, 27 Feb 2011 19:39:26 +0000
(19:39 +0000)
committer
ivan
<ivan>
Sun, 27 Feb 2011 19:39:26 +0000
(19:39 +0000)
FS/bin/freeside-torrus-srvderive
patch
|
blob
|
history
diff --git
a/FS/bin/freeside-torrus-srvderive
b/FS/bin/freeside-torrus-srvderive
index
b645016
..
516df55
100644
(file)
--- 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;
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;
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 = "
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
";
WHERE other.serviceid IN ($sin)
AND ABS( $cur - $other_date ) <= 60
";