From 6a5082507d5abded724a2701a5a4b8f122a29a3d Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 1 Oct 2024 12:09:24 +0200 Subject: [PATCH 1/2] fix console logging --- lib/MetaCPAN/Script/Runner.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/MetaCPAN/Script/Runner.pm b/lib/MetaCPAN/Script/Runner.pm index 61245daf5..7a3bf4469 100644 --- a/lib/MetaCPAN/Script/Runner.pm +++ b/lib/MetaCPAN/Script/Runner.pm @@ -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 { From 6e1da8f58e09554751e99a939119017fe12c0acd Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 1 Oct 2024 12:16:22 +0200 Subject: [PATCH 2/2] use _doc sorting in latest script We're scrolling through all latest modules. We don't care about the order, use _doc sorting for better performance. --- lib/MetaCPAN/Script/Latest.pm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/MetaCPAN/Script/Latest.pm b/lib/MetaCPAN/Script/Latest.pm index 73b78154a..8e3515831 100644 --- a/lib/MetaCPAN/Script/Latest.pm +++ b/lib/MetaCPAN/Script/Latest.pm @@ -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;