Hello community, here is the log from the commit of package perl-Minion for openSUSE:Factory checked in at 2016-04-12 19:39:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Minion (Old) and /work/SRC/openSUSE:Factory/.perl-Minion.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Minion" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Minion/perl-Minion.changes 2016-03-16 10:34:09.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Minion.new/perl-Minion.changes 2016-04-12 19:39:02.000000000 +0200 @@ -1,0 +2,18 @@ +Mon Apr 11 12:49:32 UTC 2016 - coolo@suse.com + +- updated to 5.03 + see /usr/share/doc/packages/perl-Minion/Changes + + 5.03 2016-04-10 + - Added enqueue event to Minion. (jberger) + +------------------------------------------------------------------- +Mon Apr 4 09:58:24 UTC 2016 - coolo@suse.com + +- updated to 5.02 + see /usr/share/doc/packages/perl-Minion/Changes + + 5.02 2016-03-23 + - Fixed copyright notice. + +------------------------------------------------------------------- Old: ---- Minion-5.01.tar.gz New: ---- Minion-5.03.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Minion.spec ++++++ --- /var/tmp/diff_new_pack.v0pXDo/_old 2016-04-12 19:39:02.000000000 +0200 +++ /var/tmp/diff_new_pack.v0pXDo/_new 2016-04-12 19:39:02.000000000 +0200 @@ -17,7 +17,7 @@ Name: perl-Minion -Version: 5.01 +Version: 5.03 Release: 0 %define cpan_name Minion Summary: Job queue ++++++ Minion-5.01.tar.gz -> Minion-5.03.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.01/Changes new/Minion-5.03/Changes --- old/Minion-5.01/Changes 2016-02-24 12:00:57.000000000 +0100 +++ new/Minion-5.03/Changes 2016-04-10 18:57:18.000000000 +0200 @@ -1,4 +1,10 @@ +5.03 2016-04-10 + - Added enqueue event to Minion. (jberger) + +5.02 2016-03-23 + - Fixed copyright notice. + 5.01 2016-02-24 - Fixed worker command to repair in regular intervals. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.01/META.json new/Minion-5.03/META.json --- old/Minion-5.01/META.json 2016-02-24 12:05:00.000000000 +0100 +++ new/Minion-5.03/META.json 2016-04-10 19:02:44.000000000 +0200 @@ -54,5 +54,5 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "5.01" + "version" : "5.03" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.01/META.yml new/Minion-5.03/META.yml --- old/Minion-5.01/META.yml 2016-02-24 12:05:00.000000000 +0100 +++ new/Minion-5.03/META.yml 2016-04-10 19:02:44.000000000 +0200 @@ -27,4 +27,4 @@ homepage: http://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/minion.git -version: '5.01' +version: '5.03' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.01/lib/Minion.pm new/Minion-5.03/lib/Minion.pm --- old/Minion-5.01/lib/Minion.pm 2016-02-17 14:42:21.000000000 +0100 +++ new/Minion-5.03/lib/Minion.pm 2016-04-10 18:57:04.000000000 +0200 @@ -16,11 +16,16 @@ has remove_after => 172800; has tasks => sub { {} }; -our $VERSION = '5.01'; +our $VERSION = '5.03'; sub add_task { ($_[0]->tasks->{$_[1]} = $_[2]) and return $_[0] } -sub enqueue { shift->backend->enqueue(@_) } +sub enqueue { + my $self = shift; + my $id = $self->backend->enqueue(@_); + $self->emit(enqueue => $id); + return $id; +} sub job { my ($self, $id) = @_; @@ -195,6 +200,20 @@ L<Minion> inherits all events from LMojo::EventEmitter and can emit the following new ones. +=head2 enqueue + + $minion->on(enqueue => sub { + my ($minion, $id) = @_; + ... + }); + +Emitted after a job has been enqueued, in the process that enqueued it. + + $minion->on(enqueue => sub { + my ($minion, $id) = @_; + say "Job $id has been enqueued."; + }); + =head2 worker $minion->on(worker => sub { @@ -352,7 +371,12 @@ $minion->perform_jobs; $minion->perform_jobs({queues => ['important']}); -Perform all jobs, very useful for testing. +Perform all jobs with a temporary worker, very useful for testing. + + # Longer version + my $worker = $minion->worker; + while (my $job = $worker->register->dequeue(0)) { $job->perform } + $worker->unregister; These options are currently available: @@ -479,13 +503,15 @@ Brian Medley +Joel Berger + Paul Williams =back =head1 COPYRIGHT AND LICENSE -Copyright (C) 2014-2016, Sebastian Riedel. +Copyright (C) 2014-2016, Sebastian Riedel and others. This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.01/t/pg.t new/Minion-5.03/t/pg.t --- old/Minion-5.01/t/pg.t 2016-02-16 22:27:01.000000000 +0100 +++ new/Minion-5.03/t/pg.t 2016-04-10 19:00:37.000000000 +0200 @@ -356,9 +356,9 @@ $worker->unregister; # Events -my $pid; -my $failed = 0; -$finished = 0; +my ($enqueue, $pid); +my $failed = $finished = 0; +$minion->once(enqueue => sub { $enqueue = pop }); $minion->once( worker => sub { my ($minion, $worker) = @_; @@ -380,7 +380,8 @@ } ); $worker = $minion->worker->register; -$minion->enqueue(add => [3, 3]); +$id = $minion->enqueue(add => [3, 3]); +is $enqueue, $id, 'enqueue event has been emitted'; $minion->enqueue(add => [4, 3]); $job = $worker->dequeue(0); is $failed, 0, 'failed event has not been emitted';