projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0d16979
)
optimize CDR rating after timed rate perf regression, RT#15739
author
ivan
<ivan>
Wed, 4 Jan 2012 01:17:40 +0000
(
01:17
+0000)
committer
ivan
<ivan>
Wed, 4 Jan 2012 01:17:40 +0000
(
01:17
+0000)
FS/FS/Schema.pm
patch
|
blob
|
history
FS/FS/cdr.pm
patch
|
blob
|
history
diff --git
a/FS/FS/Schema.pm
b/FS/FS/Schema.pm
index
c2f40f6
..
78d88dd
100644
(file)
--- a/
FS/FS/Schema.pm
+++ b/
FS/FS/Schema.pm
@@
-2692,7
+2692,9
@@
sub tables_hashref {
],
'primary_key' => 'ratedetailnum',
'unique' => [ [ 'ratenum', 'orig_regionnum', 'dest_regionnum' ] ],
],
'primary_key' => 'ratedetailnum',
'unique' => [ [ 'ratenum', 'orig_regionnum', 'dest_regionnum' ] ],
- 'index' => [ [ 'ratenum', 'dest_regionnum' ] ],
+ 'index' => [ [ 'ratenum', 'dest_regionnum' ],
+ [ 'ratenum', 'ratetimenum' ]
+ ],
},
'rate_region' => {
},
'rate_region' => {
diff --git
a/FS/FS/cdr.pm
b/FS/FS/cdr.pm
index
842cfab
..
ff07a59
100644
(file)
--- a/
FS/FS/cdr.pm
+++ b/
FS/FS/cdr.pm
@@
-692,8
+692,11
@@
sub rate_prefix {
if ( !exists($interval_cache{$regionnum}) ) {
my @intervals = (
sort { $a->stime <=> $b->stime }
if ( !exists($interval_cache{$regionnum}) ) {
my @intervals = (
sort { $a->stime <=> $b->stime }
- map { my $r = $_->rate_time; $r ? $r->intervals : () }
- $rate->rate_detail
+ map { $_->rate_time->intervals }
+ qsearch({ 'table' => 'rate_detail',
+ 'hashref' => { 'ratenum' => $rate->ratenum },
+ 'extra_sql' => 'AND ratetimenum IS NOT NULL',
+ })
);
$interval_cache{$regionnum} = \@intervals;
warn " cached ".scalar(@intervals)." interval(s)\n"
);
$interval_cache{$regionnum} = \@intervals;
warn " cached ".scalar(@intervals)." interval(s)\n"
@@
-1256,6
+1259,7
@@
CDR reprocessing.
sub clear_status {
my $self = shift;
sub clear_status {
my $self = shift;
+ my %opt = @_;
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
@@
-1271,6
+1275,7
@@
sub clear_status {
if ( $cdr_prerate && $cdr_prerate_cdrtypenums{$self->cdrtypenum}
&& $self->rated_ratedetailnum #avoid putting old CDRs back in "rated"
&& $self->freesidestatus eq 'done'
if ( $cdr_prerate && $cdr_prerate_cdrtypenums{$self->cdrtypenum}
&& $self->rated_ratedetailnum #avoid putting old CDRs back in "rated"
&& $self->freesidestatus eq 'done'
+ && ! $opt{'rerate'}
)
{ #special case
$self->freesidestatus('rated');
)
{ #special case
$self->freesidestatus('rated');