Skip to content

Commit

Permalink
Merge pull request #489 from CPAN-API/mickey/queue_from_script_release
Browse files Browse the repository at this point in the history
Support queueing from Script::Release
  • Loading branch information
oalders committed Jun 2, 2016
2 parents 2f37a82 + 79cbca8 commit 37f52c6
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions lib/MetaCPAN/Script/Release.pm
Expand Up @@ -14,6 +14,7 @@ use LWP::UserAgent;
use Log::Contextual qw( :log :dlog );
use MetaCPAN::Util;
use MetaCPAN::Model::Release;
use MetaCPAN::Script::Runner;
use MetaCPAN::Types qw( Bool Dir HashRef Int Str );
use Moose;
use PerlIO::gzip;
Expand Down Expand Up @@ -41,6 +42,13 @@ has skip => (
documentation => 'skip already indexed modules (0)',
);

has queue => (
is => 'ro',
isa => Bool,
default => 0,
documentation => 'add indexing jobs to the minion queue',
);

has status => (
is => 'ro',
isa => Str,
Expand Down Expand Up @@ -169,12 +177,18 @@ sub run {
}
}

try { $self->import_archive($file) }
catch {
$self->handle_error("$file $_[0]");
};
if ( $self->queue ) {
local @ARGV = ( qw{ queue --file }, $file );
MetaCPAN::Script::Runner->run;
}
else {
try { $self->import_archive($file) }
catch {
$self->handle_error("$file $_[0]");
};
}
}
$self->index->refresh;
$self->index->refresh unless $self->queue;

# Call Fastly to purge
$self->cdn_purge_cpan_distnameinfos( \@module_to_purge_dists );
Expand Down

0 comments on commit 37f52c6

Please sign in to comment.