=encoding utf8 =head1 Mojolicious::Plugin::Minion::Workers Доброго всем ¡ ¡ ¡ ALL GLORY TO GLORIA ! ! ! =head1 VERSION 0.09073 (up to Minion 9.07/100+C) =head1 NAME Mojolicious::Plugin::Minion::Workers - does extend base Mojolicious::Plugin::Minion on manage Minion workers. =head1 SYNOPSIS # Mojolicious (define amount workers in config) $self->plugin('Minion::Workers' => {Pg => ..., workers=>2}); # or pass to $app->minion->manage_workers() later $self->plugin('Minion::Workers' => {Pg => ...}); # Mojolicious::Lite (define amount workers in config) plugin 'Minion::Workers' => {Pg => ..., workers=>2}; # Add tasks to your application app->minion->add_task(slow_log => sub { my ($job, $msg) = @_; sleep 5; $job->app->log->debug(qq{Received message "$msg"}); }); # Allow manage with amount workers (gets from config) app->minion->manage_workers(); # or override config workers by pass app->minion->manage_workers(4); # Start jobs from anywhere in your application =head1 DESCRIPTION L is a L plugin for the L job queue and has extending base L for enable workers managment. =head1 Manage workers L has patch the L module on the following new one method. =head2 manage_workers(int) Start/restart Minion passed amount workers or get its from plugin config. None workers mean skip managment. $app->minion->manage_workers(1); Tested on standard commands (on Linux): $ perl script/app.pl daemon # one minion worker will be starting $ perl script/app.pl prefork # your amount minion workers will be starting $ morbo script/app.pl # when morbo restarts on watch changes one minion worker will be restarting too $ hypnotoad script/app.pl # your amount minion workers will be starting $ hypnotoad script/app.pl # on hot deploy minion workers will be restarting too $ hypnotoad -s script/app.pl # minion workers will stoping too B. For commands C<$ morbo script/app.pl> and C<$ perl script/app.pl daemon> workers always one. B. In case hypnotoad and C<$ kill -USR2 app_pid> minion workers will not restarts, sorry. Always use command C<$ hypnotoad script/app.pl>. B. When minion workers restarts then B exists processes stoped. So if you run many separate apps then dont use this module. =head1 HELPERS L enable all helpers from base plugin L, thus you dont need apply base plugin (auto register). =head1 METHODS L inherits all methods from L and override the following new ones. =head2 register $plugin->register(Mojolicious->new, {Pg => ..., worker=>1}); Register plugin in L application. =head1 SEE ALSO L, L, L, L. =head1 AUTHOR Михаил Че (Mikhail Che), C<< >> =head1 BUGS / CONTRIBUTING Please report any bugs or feature requests at L. Pull requests also welcome. =head1 COPYRIGHT Copyright 2019+ Mikhail Che. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut