From: ivan Date: Sun, 25 Jul 2010 07:30:42 +0000 (+0000) Subject: limit memory use when upgrading attachments X-Git-Tag: root_of_svc_elec_features~28 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=24e81f4d632ebb4af2d8a68e64352c37052781b5;p=freeside.git limit memory use when upgrading attachments --- diff --git a/FS/FS/otaker_Mixin.pm b/FS/FS/otaker_Mixin.pm index 4aa47c38d..0da9aeedb 100644 --- a/FS/FS/otaker_Mixin.pm +++ b/FS/FS/otaker_Mixin.pm @@ -40,11 +40,13 @@ sub _upgrade_otaker { my $class = shift; my $table = $class->table; + my $limit = ( $table eq 'cust_attachment' ? 10 : 1000 ); + while ( 1 ) { my @records = qsearch({ 'table' => $table, 'hashref' => {}, - 'extra_sql' => 'WHERE otaker IS NOT NULL LIMIT 1000', + 'extra_sql' => "WHERE otaker IS NOT NULL LIMIT $limit", }); last unless @records;