Hello community, here is the log from the commit of package perl-Minion for openSUSE:Factory checked in at 2015-05-18 22:23:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2015-04-23 08:05:12.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Minion.new/perl-Minion.changes 2015-05-18 22:23:21.000000000 +0200 @@ -1,0 +2,12 @@ +Sat May 16 08:20:13 UTC 2015 - coolo@suse.com + +- updated to 1.15 + see /usr/share/doc/packages/perl-Minion/Changes + + 1.15 2015-05-15 + - Added support for retrying jobs with a delay. (kwa) + - Added delay option to retry method in Minion::Job. (kwa) + - Added delay option to retry_job method in Minion::Backend::File. (kwa) + - Added delay option to retry_job method in Minion::Backend::Pg. (kwa) + +------------------------------------------------------------------- Old: ---- Minion-1.14.tar.gz New: ---- Minion-1.15.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Minion.spec ++++++ --- /var/tmp/diff_new_pack.kZ9wUV/_old 2015-05-18 22:23:22.000000000 +0200 +++ /var/tmp/diff_new_pack.kZ9wUV/_new 2015-05-18 22:23:22.000000000 +0200 @@ -17,7 +17,7 @@ Name: perl-Minion -Version: 1.14 +Version: 1.15 Release: 0 %define cpan_name Minion Summary: Job queue ++++++ Minion-1.14.tar.gz -> Minion-1.15.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/Changes new/Minion-1.15/Changes --- old/Minion-1.14/Changes 2015-04-21 20:02:37.000000000 +0200 +++ new/Minion-1.15/Changes 2015-05-15 23:42:01.000000000 +0200 @@ -1,4 +1,10 @@ +1.15 2015-05-15 + - Added support for retrying jobs with a delay. (kwa) + - Added delay option to retry method in Minion::Job. (kwa) + - Added delay option to retry_job method in Minion::Backend::File. (kwa) + - Added delay option to retry_job method in Minion::Backend::Pg. (kwa) + 1.14 2015-04-21 - Improved performance of Minion::Backend::Pg with a new index. (avkhozov) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/META.json new/Minion-1.15/META.json --- old/Minion-1.14/META.json 2015-04-22 00:37:46.000000000 +0200 +++ new/Minion-1.15/META.json 2015-05-15 23:43:54.000000000 +0200 @@ -53,5 +53,5 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "1.14" + "version" : "1.15" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/META.yml new/Minion-1.15/META.yml --- old/Minion-1.14/META.yml 2015-04-22 00:37:46.000000000 +0200 +++ new/Minion-1.15/META.yml 2015-05-15 23:43:53.000000000 +0200 @@ -28,4 +28,4 @@ homepage: http://mojolicio.us license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/minion.git -version: '1.14' +version: '1.15' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/lib/Minion/Backend/File.pm new/Minion-1.15/lib/Minion/Backend/File.pm --- old/Minion-1.14/lib/Minion/Backend/File.pm 2015-03-17 04:19:45.000000000 +0100 +++ new/Minion-1.15/lib/Minion/Backend/File.pm 2015-05-15 19:41:01.000000000 +0200 @@ -120,13 +120,16 @@ sub reset { $_[0]->db and delete($_[0]->{db})->clear } sub retry_job { - my ($self, $id) = @_; + my ($self, $id) = (shift, shift); + my $options = shift // {}; my $guard = $self->_exclusive; return undef unless my $job = $self->_job($id, 'failed', 'finished'); $job->{retries} += 1; + $job->{delayed} = time + $options->{delay} if $options->{delay}; @$job{qw(retried state)} = (time, 'inactive'); delete @$job{qw(finished result started worker)}; + return 1; } @@ -275,7 +278,7 @@ delay => 10 -Delay job for this many seconds from now. +Delay job for this many seconds (from now). =item priority @@ -372,9 +375,22 @@ =head2 retry_job my $bool = $backend->retry_job($job_id); + my $bool = $backend->retry_job($job_id, {delay => 10}); Transition from C<failed> or C<finished> state back to C<inactive>. +These options are currently available: + +=over 2 + +=item delay + + delay => 10 + +Delay job for this many seconds (from now). + +=back + =head2 stats my $stats = $backend->stats; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/lib/Minion/Backend/Pg.pm new/Minion-1.15/lib/Minion/Backend/Pg.pm --- old/Minion-1.14/lib/Minion/Backend/Pg.pm 2015-04-21 20:01:39.000000000 +0200 +++ new/Minion-1.15/lib/Minion/Backend/Pg.pm 2015-05-15 19:41:14.000000000 +0200 @@ -128,12 +128,16 @@ sub reset { shift->pg->db->query('truncate minion_jobs, minion_workers') } sub retry_job { - !!shift->pg->db->query( + my ($self, $id) = (shift, shift); + my $options = shift // {}; + + return !!$self->pg->db->query( "update minion_jobs set finished = null, result = null, retried = now(), - retries = retries + 1, started = null, state = 'inactive', worker = null + retries = retries + 1, started = null, state = 'inactive', + worker = null, delayed = (now() + (interval '1 second' * ?)) where id = ? and state in ('failed', 'finished') - returning 1", shift + returning 1", $options->{delay} // 0, $id )->rows; } @@ -264,7 +268,7 @@ delay => 10 -Delay job for this many seconds from now. +Delay job for this many seconds (from now). =item priority @@ -361,9 +365,22 @@ =head2 retry_job my $bool = $backend->retry_job($job_id); + my $bool = $backend->retry_job($job_id, {delay => 10}); Transition from C<failed> or C<finished> state back to C<inactive>. +These options are currently available: + +=over 2 + +=item delay + + delay => 10 + +Delay job for this many seconds (from now). + +=back + =head2 stats my $stats = $backend->stats; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/lib/Minion/Backend.pm new/Minion-1.15/lib/Minion/Backend.pm --- old/Minion-1.14/lib/Minion/Backend.pm 2015-03-07 07:57:49.000000000 +0100 +++ new/Minion-1.15/lib/Minion/Backend.pm 2015-05-15 19:41:58.000000000 +0200 @@ -101,7 +101,7 @@ delay => 10 -Delay job for this many seconds from now. +Delay job for this many seconds (from now). =item priority @@ -200,10 +200,23 @@ =head2 retry_job my $bool = $backend->retry_job($job_id); + my $bool = $backend->retry_job($job_id, {delay => 10}); Transition from C<failed> or C<finished> state back to C<inactive>. Meant to be overloaded in a subclass. +These options are currently available: + +=over 2 + +=item delay + + delay => 10 + +Delay job for this many seconds (from now). + +=back + =head2 stats my $stats = $backend->stats; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/lib/Minion/Command/minion/job.pm new/Minion-1.15/lib/Minion/Command/minion/job.pm --- old/Minion-1.14/lib/Minion/Command/minion/job.pm 2015-03-08 23:31:38.000000000 +0100 +++ new/Minion-1.15/lib/Minion/Command/minion/job.pm 2015-05-15 19:34:30.000000000 +0200 @@ -42,7 +42,7 @@ return $job->remove || die "Job is active.\n" if $remove; # Retry job - return $job->retry || die "Job is active.\n" if $retry; + return $job->retry($options) || die "Job is active.\n" if $retry; # Job info $self->_info($job); @@ -114,7 +114,7 @@ ./myapp.pl minion job -s ./myapp.pl minion job -w -l 5 ./myapp.pl minion job 10023 - ./myapp.pl minion job -R 10023 + ./myapp.pl minion job -R -d 10 10023 ./myapp.pl minion job -r 10023 Options: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/lib/Minion/Job.pm new/Minion-1.15/lib/Minion/Job.pm --- old/Minion-1.14/lib/Minion/Job.pm 2015-03-08 18:09:45.000000000 +0100 +++ new/Minion-1.15/lib/Minion/Job.pm 2015-05-15 19:40:49.000000000 +0200 @@ -39,7 +39,7 @@ sub remove { $_[0]->minion->backend->remove_job($_[0]->id) } -sub retry { $_[0]->minion->backend->retry_job($_[0]->id) } +sub retry { $_[0]->minion->backend->retry_job($_[0]->id, $_[1]) } sub start { my $self = shift; @@ -225,9 +225,22 @@ =head2 retry my $bool = $job->retry; + my $bool = $job->retry({delay => 10}); Transition from C<failed> or C<finished> state back to C<inactive>. +These options are currently available: + +=over 2 + +=item delay + + delay => 10 + +Delay job for this many seconds (from now). + +=back + =head2 start my $pid = $job->start; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/lib/Minion.pm new/Minion-1.15/lib/Minion.pm --- old/Minion-1.14/lib/Minion.pm 2015-04-21 20:48:22.000000000 +0200 +++ new/Minion-1.15/lib/Minion.pm 2015-05-15 19:40:28.000000000 +0200 @@ -15,7 +15,7 @@ has remove_after => 864000; has tasks => sub { {} }; -our $VERSION = '1.14'; +our $VERSION = '1.15'; sub add_task { ($_[0]->tasks->{$_[1]} = $_[2]) and return $_[0] } @@ -250,7 +250,7 @@ delay => 10 -Delay job for this many seconds from now. +Delay job for this many seconds (from now). =item priority @@ -355,6 +355,8 @@ Brian Medley +Paul Williams + =back =head1 COPYRIGHT AND LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/t/file.t new/Minion-1.15/t/file.t --- old/Minion-1.14/t/file.t 2015-03-22 07:20:07.000000000 +0100 +++ new/Minion-1.15/t/file.t 2015-05-15 18:33:35.000000000 +0200 @@ -300,6 +300,14 @@ ok $minion->job($id)->info->{delayed} < time, 'no delayed timestamp'; ok $job->remove, 'job removed'; ok !$job->retry, 'job not retried'; +$id = $minion->enqueue(add => [6, 9]); +$job = $worker->dequeue(0); +ok $job->info->{delayed} < time, 'no delayed timestamp'; +ok $job->fail, 'job failed'; +ok $job->retry({delay => 100}), 'job retried with delay'; +is $job->info->{retries}, 1, 'job has been retried once'; +ok $job->info->{delayed} > time, 'delayed timestamp'; +ok $minion->job($id)->remove, 'job has been removed'; $worker->unregister; # Events diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.14/t/pg.t new/Minion-1.15/t/pg.t --- old/Minion-1.14/t/pg.t 2015-03-25 05:50:54.000000000 +0100 +++ new/Minion-1.15/t/pg.t 2015-05-15 18:33:39.000000000 +0200 @@ -325,6 +325,14 @@ ok $minion->job($id)->info->{delayed} < time, 'no delayed timestamp'; ok $job->remove, 'job removed'; ok !$job->retry, 'job not retried'; +$id = $minion->enqueue(add => [6, 9]); +$job = $worker->dequeue(0); +ok $job->info->{delayed} < time, 'no delayed timestamp'; +ok $job->fail, 'job failed'; +ok $job->retry({delay => 100}), 'job retried with delay'; +is $job->info->{retries}, 1, 'job has been retried once'; +ok $job->info->{delayed} > time, 'delayed timestamp'; +ok $minion->job($id)->remove, 'job has been removed'; $worker->unregister; # Failed jobs