Skip to content

Commit f6337fa

Browse files
committed
also cache author email lookup in contributor update
1 parent fec6578 commit f6337fa

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/MetaCPAN/Script/Role/Contributor.pm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ has email_mapping => (
104104
is => 'ro',
105105
default => sub { {} },
106106
);
107+
has author_mapping => (
108+
is => 'ro',
109+
default => sub { {} },
110+
);
107111

108112
sub get_contributors {
109113
my ( $self, $release ) = @_;
@@ -124,13 +128,13 @@ sub get_contributors {
124128
}
125129
$authors = [ grep { $_ ne 'unknown' } @$authors ];
126130

127-
my $author = eval {
128-
$self->es->get_source( es_doc_path('author'), id => $author_name );
131+
my $author_mapping = $self->author_mapping;
132+
my $author_email = $author_mapping->{$author_name} //= eval {
133+
$self->es->get_source( es_doc_path('author'), id => $author_name )
134+
->{email};
129135
}
130136
or return [];
131137

132-
my $author_email = $author->{email};
133-
134138
my $author_info = {
135139
email => [
136140
lc "$author_name\@cpan.org",

0 commit comments

Comments
 (0)