Created role for Minion Jobs to make dev easier
This commit is contained in:
parent
c0375dcd41
commit
30c210200f
4 changed files with 29 additions and 6 deletions
|
@ -7,15 +7,16 @@ sub register {
|
|||
my ( $plugin, $app, $cong ) = @_;
|
||||
|
||||
if ( defined $app->config->{minion} ) {
|
||||
$app->log->debug('Setting up Minion');
|
||||
$app->log->debug('Setting up Minion tasks');
|
||||
$app->plugin('Minion' => $app->config->{minion} );
|
||||
|
||||
$app->log->debug('Loaded Minion Job packages:');
|
||||
|
||||
my $job_namespace = __PACKAGE__ . '::Job';
|
||||
my @modules = find_modules $job_namespace;
|
||||
for my $package ( @modules ) {
|
||||
my ( $job ) = $package =~ /${job_namespace}::(.*)$/;
|
||||
$app->log->debug( $package );
|
||||
$app->log->debug( $job );
|
||||
load_class $package;
|
||||
$app->minion->add_task(
|
||||
$job => sub {
|
||||
|
@ -27,7 +28,7 @@ sub register {
|
|||
}
|
||||
);
|
||||
}
|
||||
# $app->minion->enqueue('test' => [ 'test arg 1', 'test_arg 2' ] );
|
||||
# $app->minion->enqueue('test' => [ 'test arg 1', 'test_arg 2' ] );
|
||||
} else {
|
||||
$app->log->debug('No Minion Config');
|
||||
}
|
||||
|
|
Reference in a new issue