Skip to content

Commit

Permalink
also cache author email lookup in contributor update
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Nov 23, 2024
1 parent fec6578 commit f6337fa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/MetaCPAN/Script/Role/Contributor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ has email_mapping => (
is => 'ro',
default => sub { {} },
);
has author_mapping => (
is => 'ro',
default => sub { {} },
);

sub get_contributors {
my ( $self, $release ) = @_;
Expand All @@ -124,13 +128,13 @@ sub get_contributors {
}
$authors = [ grep { $_ ne 'unknown' } @$authors ];

my $author = eval {
$self->es->get_source( es_doc_path('author'), id => $author_name );
my $author_mapping = $self->author_mapping;
my $author_email = $author_mapping->{$author_name} //= eval {
$self->es->get_source( es_doc_path('author'), id => $author_name )
->{email};
}
or return [];

my $author_email = $author->{email};

my $author_info = {
email => [
lc "$author_name\@cpan.org",
Expand Down

0 comments on commit f6337fa

Please sign in to comment.