diff options
author | Mark Wells <mark@freeside.biz> | 2012-05-19 14:57:29 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2012-05-19 14:57:29 -0700 |
commit | 2b740ea3cbb32a3fb3906546552503d9d3cca590 (patch) | |
tree | abbb98e7671971b947c30929ab4a00e742ef4e66 /FS/FS/part_pkg/voip_inbound.pm | |
parent | bec96a5b94e6c2484a48ed2d4300a1294fa80de6 (diff) |
paged search to conserve memory in CDR processing, #16723
Diffstat (limited to 'FS/FS/part_pkg/voip_inbound.pm')
-rw-r--r-- | FS/FS/part_pkg/voip_inbound.pm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/FS/FS/part_pkg/voip_inbound.pm b/FS/FS/part_pkg/voip_inbound.pm index f4e5183..ecc4f47 100644 --- a/FS/FS/part_pkg/voip_inbound.pm +++ b/FS/FS/part_pkg/voip_inbound.pm @@ -227,13 +227,15 @@ sub calc_usage { ) { my $svc_phone = $cust_svc->svc_x; - foreach my $cdr ( $svc_phone->get_cdrs( + my $cdr_search = $svc_phone->psearch_cdrs( 'inbound' => 1, 'default_prefix' => $self->option('default_prefix'), 'status' => '', # unprocessed only 'for_update' => 1, - ) - ) { + ); + $cdr_search->limit(1000); + $cdr_search->increment(0); + while ( my $cdr = $cdr_search->fetch ) { my $reason = $self->check_chargable( $cdr, 'option_cache' => \%opt_cache, @@ -310,6 +312,8 @@ sub calc_usage { die $error if $error; $formatter->append($cdr); + $cdr_search->adjust(1) if $cdr->freesidestatus eq ''; + } #$cdr } # $cust_svc # unshift @$details, { format => 'C', |