Skip to content

Commit

Permalink
Merge pull request #1280 from metacpan/haarg/fix-latest-perf
Browse files Browse the repository at this point in the history
Fix performance of latest script
  • Loading branch information
haarg authored Oct 1, 2024
2 parents a5dc636 + 6e1da8f commit 36ada25
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/MetaCPAN/Script/Latest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,19 @@ sub run {
'Searching for ' . @$filter . ' of ' . $total . ' modules'
}
if @module_filters > 1;
my $scroll = $self->index->type('file')->query($query)->source( [ qw(
author date distribution download_url module.name release status
) ] )->size(100)->raw->scroll;

my $scroll = $self->es->scroll_helper( {
index => $self->index->name,
type => 'file',
size => 100,
body => {
query => $query,
_source => [
qw(author date distribution download_url module.name release status)
],
sort => '_doc',
},
} );

$found_total += $scroll->total;

Expand Down
8 changes: 8 additions & 0 deletions lib/MetaCPAN/Script/Runner.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ sub run {
or File::Path::mkpath($path);
}

if ( -t *STDERR ) {
push @{ $config->{logger} },
{
class => 'Log::Log4perl::Appender::ScreenColoredLevels',
stdout => 0,
};
}

my $obj = undef;
my $ex = undef;
try {
Expand Down

0 comments on commit 36ada25

Please sign in to comment.