[freeside-commits] freeside/FS/bin freeside-torrus-srvderive, 1.49, 1.50
Ivan,,,
ivan at wavetail.420.am
Thu May 19 08:51:53 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail.420.am:/tmp/cvs-serv11346
Modified Files:
freeside-torrus-srvderive
Log Message:
optimize torrus-srvderive, RT#10574
Index: freeside-torrus-srvderive
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-torrus-srvderive,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -w -d -r1.49 -r1.50
--- freeside-torrus-srvderive 29 Apr 2011 01:36:35 -0000 1.49
+++ freeside-torrus-srvderive 19 May 2011 15:51:50 -0000 1.50
@@ -60,8 +60,8 @@
my $orderlimit = "
ORDER BY srv_date, srv_time
- LIMIT 100
-"; #50?
+ LIMIT 50
+";
if ( driver_name eq 'mysql' ) {
dbh->do('SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED');
@@ -195,9 +195,12 @@
my $sin = join(',', map dbh->quote("$_$dir"), @serviceids);
+ my $srv_date = time2str('%Y-%m-%d', $cur);
+
my $sum = "
SELECT COALESCE(SUM(value),0) FROM srvexport AS other
WHERE other.serviceid IN ($sin)
+ AND other.srv_date = '$srv_date'
AND ABS( $cur - $other_date ) <= 60
";
@@ -205,9 +208,9 @@
INSERT INTO srvexport ( srv_date, srv_time, serviceid, value, intvl )
VALUES ( ?, ?, ?, ($sum), ? )
";
- my @param = ( time2str('%Y-%m-%d', $cur), #srv_date
+ my @param = ( $srv_date,
time2str('%X', $cur), #srv_time
- "$serviceid$dir",
+ "$serviceid$dir", #serviceid
300, #intvl ...
);
warn $isql. ' with param '. join(',', at param). "\n"
More information about the freeside-commits
mailing list