-
-
01 Feb 2019 04:33:05 UTC
- Distribution: Mojolicious-Plugin-Minion-Workers
- Module version: 0.09074
- Source (raw)
- Pod Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (265 / 0 / 0)
- Kwalitee
Bus factor: 1- 6.12% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (4.82KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- ÐÐ¸Ñ Ð°Ð¸Ð» Че (Mikhail Che) <mche[-at-]cpan.org>
- Dependencies
- Minion
- Mojolicious
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- Mojolicious::Plugin::Minion::Workers
- VERSION
- NAME
- SYNOPSIS
- DESCRIPTION
- Manage workers
- HELPERS
- METHODS
- SEE ALSO
- AUTHOR
- BUGS / CONTRIBUTING
- COPYRIGHT
Mojolicious::Plugin::Minion::Workers
Доброго всем
¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !
VERSION
0.09074 (up to Minion 9.07/100+
my minors
)NAME
Mojolicious::Plugin::Minion::Workers - does extend base Mojolicious::Plugin::Minion on manage Minion workers.
SYNOPSIS
# Mojolicious (define amount workers in config) $self->plugin('Minion::Workers' => {Pg => ..., workers=>2}); # or pass to $app->minion->manage_workers(<num>) 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"}); }); # Start manage with amount workers app->minion->workers->manage(4); # or get from config app->minion->workers->manage(); # Start jobs from anywhere in your application
DESCRIPTION
Mojolicious::Plugin::Minion::Workers is a Mojolicious plugin for the Minion job queue and has extending base Mojolicious::Plugin::Minion for enable workers managment.
Manage workers
Mojolicious::Plugin::Minion::Workers add attr workers to the
$app->minion
object.$app->minion->workers
object has following new one public method.manage(integer amount)
Start/restart Minion passed amount workers or get its from plugin config. None workers mean skip managment.
$app->minion->workers->manage(2);
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
NOTE. For commands
$ morbo script/app.pl
and$ perl script/app.pl daemon
workers always one.NOTE. In case hypnotoad and
$ kill -USR2 app_pid
minion workers will not restarts, sorry. Always use command$ hypnotoad script/app.pl
.BIG NOTE. When minion workers restarts (hypnotoad | morbo) then ALL exists minion processes stoped. So if you run many separate apps with one database backend then dont use this module. Or set separate backends as well.
HELPERS
Mojolicious::Plugin::Minion::Workers enable all helpers trough base plugin Mojolicious::Plugin::Minion, thus you dont need apply base plugin (auto register).
METHODS
Mojolicious::Plugin::Minion::Workers inherits all methods from Mojolicious::Plugin::Minion and override the following new ones.
register
$plugin->register(Mojolicious->new, {Pg => ..., worker=>1});
Register plugin in Mojolicious application.
SEE ALSO
Mojolicious::Plugin::Minion, Minion, Mojolicious::Guides, https://mojolicious.org.
AUTHOR
Михаил Че (Mikhail Che),
<mche[-at-]cpan.org>
BUGS / CONTRIBUTING
Please report any bugs or feature requests at https://github.com/mche/Mojolicious-Plugin-Minion-Workers/issues. Pull requests also welcome.
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.
Module Install Instructions
To install Mojolicious::Plugin::Minion::Workers, copy and paste the appropriate command in to your terminal.
cpanm Mojolicious::Plugin::Minion::Workers
perl -MCPAN -e shell install Mojolicious::Plugin::Minion::Workers
For more information on module installation, please visit the detailed CPAN module installation guide.