Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

When reindexing, build a nested hash of UIDs rather than an array - u…

…ses half the memory
  • Loading branch information...
commit 02466581d993ccd93d497daaa7df46fe9d21462d 1 parent c5ec6a2
@clintongormley authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/Elastic/Model/Index.pm
View
6 lib/Elastic/Model/Index.pm
@@ -46,10 +46,10 @@ sub reindex {
# store all changed UIDs so that we can repoint them
# later, when they're used in docs that aren't being reindexed
- my @uids;
+ my %uids;
my $doc_updater = sub {
my ($doc) = $transform->(@_);
- push @uids, [ @{$doc}{qw(_index _type _id)} ];
+ $uids{ $doc->{_index} }{ $doc->{_type} }{ $doc->{_id} } = 1;
$doc->{_index} = $dest_index;
return $doc;
};
@@ -83,7 +83,7 @@ sub reindex {
return 1 unless $args{repoint_uids};
$self->repoint_uids(
- uids => \@uids,
+ uids => \%uids,
quiet => !$verbose,
exclude => [ keys %map ],
size => $size,
Please sign in to comment.
Something went wrong with that request. Please try again.