File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ has status => (
122122 isa => Str,
123123);
124124
125+ has es => ( is => ' ro' );
125126has bulk => ( is => ' ro' );
126127
127128=head2 run
@@ -221,11 +222,16 @@ sub _build_document {
221222 $document
222223 = $self -> index -> type(' release' )-> put( $document , { refresh => 1 } );
223224
224- # create will die if the document already exists
225- eval {
225+ # create distribution if doesn't exist
226+ my $dist_count = $self -> es-> count(
227+ index => ' cpan' ,
228+ type => ' distribution' ,
229+ body => { query => { term => { name => $self -> distribution } } },
230+ );
231+ if ( !$dist_count -> {count } ) {
226232 $self -> index -> type(' distribution' )
227233 -> put( { name => $self -> distribution }, { create => 1 } );
228- };
234+ }
229235 return $document ;
230236}
231237
Original file line number Diff line number Diff line change @@ -228,6 +228,7 @@ sub _get_release_model {
228228 my $d = CPAN::DistnameInfo-> new($archive_path );
229229
230230 my $model = MetaCPAN::Model::Release-> new(
231+ es => $self -> es,
231232 bulk => $bulk ,
232233 distinfo => $d ,
233234 file => $archive_path ,
You can’t perform that action at this time.
0 commit comments