File tree Expand file tree Collapse file tree 1 file changed +76
-0
lines changed Expand file tree Collapse file tree 1 file changed +76
-0
lines changed Original file line number Diff line number Diff line change 1+ use strict;
2+ use warnings;
3+ use v5.36;
4+
5+ use Getopt::Long;
6+ use MetaCPAN::Logger qw< :log :dlog > ;
7+
8+ use MetaCPAN::ES;
9+
10+ # args
11+ my ($distribution );
12+ GetOptions( " distribution=s" => \$distribution , );
13+
14+ # setup
15+ my $es = MetaCPAN::ES-> new( type => " distribution" );
16+
17+ my $query
18+ = $distribution
19+ ? { term => { name => $distribution } }
20+ : { match_all => {} };
21+
22+ my $size
23+ = $distribution
24+ ? 1
25+ : 500;
26+
27+ my $scroll = $es -> scroll(
28+ body => {
29+ query => $query ,
30+ size => $size ,
31+ },
32+ );
33+
34+ log_info { " processing " . $scroll -> total . " distributions" };
35+
36+ while ( my $distribution = $scroll -> next ) {
37+ my $release = $distribution -> set_first_release;
38+ $release
39+ ? log_debug {
40+ " @{[ $release ->name ]} by @{[ $release ->author ]} was first"
41+ }
42+ : log_warn {
43+ " no release found for distribution @{[$distribution ->name]}"
44+ };
45+ }
46+
47+ # Everything changed - reboot the world!
48+ # cdn_purge_all;
49+
50+ 1;
51+
52+ __END__
53+
54+ =pod
55+
56+ =head1 NAME
57+
58+ Set the C<first > bit after a full reindex
59+
60+ =head1 SYNOPSIS
61+
62+ $ bin/first --distribution Moose
63+
64+ =head1 DESCRIPTION
65+
66+ Setting the C<first > bit cannot be set when indexing archives in parallel,
67+ e.g. when doing a full reindex.
68+ This script sets the C<first > bit once all archives have been indexed.
69+
70+ =head1 OPTIONS
71+
72+ =head2 distribution
73+
74+ Only set the C<first > bit for releases of this distribution.
75+
76+ =cut
You can’t perform that action at this time.
0 commit comments