Skip to content

Commit

Permalink
script/bulk: use bulk_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Jun 24, 2016
1 parent 8469888 commit 966dd71
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/MetaCPAN/Script/Backpan.pm
Expand Up @@ -39,6 +39,11 @@ sub update_status {
my $es = $self->es;
$es->trace_calls(1) if $ENV{DEBUG};

my $bulk = $es->bulk_helper(
index => 'cpan_v1',
type => 'release',
);

my $scroll = $es->scroll_helper(
size => 500,
scroll => '2m',
Expand All @@ -58,13 +63,15 @@ sub update_status {
);

while ( my $release = $scroll->next ) {
$es->update(
index => 'cpan_v1',
type => 'release',
id => $release->{_id},
doc => { status => 'backpan' }
$bulk->update(
{
id => $release->{_id},
doc => { status => 'backpan' }
}
);
}

$bulk->flush;
}

__PACKAGE__->meta->make_immutable;
Expand Down

0 comments on commit 966dd71

Please sign in to comment.