diff options
author | ivan <ivan> | 2010-07-25 07:30:42 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-07-25 07:30:42 +0000 |
commit | 24e81f4d632ebb4af2d8a68e64352c37052781b5 (patch) | |
tree | bcb2b2a5f146b46bdc46d52b73aabcfa09b7dded | |
parent | 649cb6a173a4278f3c4e0c960ce5b71422329222 (diff) |
limit memory use when upgrading attachments
-rw-r--r-- | FS/FS/otaker_Mixin.pm | 4 |
1 files changed, 3 insertions, 1 deletions
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; |