Hello community, here is the log from the commit of package perl-Minion for openSUSE:Factory checked in at 2019-11-20 10:27:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Minion (Old) and /work/SRC/openSUSE:Factory/.perl-Minion.new.26869 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Minion" Wed Nov 20 10:27:41 2019 rev:51 rq:749518 version:10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Minion/perl-Minion.changes 2019-08-30 14:43:08.265410274 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Minion.new.26869/perl-Minion.changes 2019-11-20 10:27:42.850567985 +0100 @@ -1,0 +2,22 @@ +Tue Nov 19 08:36:52 UTC 2019 - <[email protected]> + +- updated to 10.0 + see /usr/share/doc/packages/perl-Minion/Changes + + 10.0 2019-11-15 + - Removed PostgreSQL migrations older than 2 years, that means you need to + have Minion version 7.01 or newer installed before you can upgrade to + version 10.0. + - Removed experimental status from result_p method in Minion. + - Removed experimental status from history method in Minion and + Minion::Backend::Pg. + - Removed experimental status from delayed_jobs and enqueued_jobs fields from + stats methods in Minion and Minion::Backend::Pg. + - Removed experimental status from cleanup and finish events in Minion::Job. + - Changed reset method in Minion and Minion::Backend::Pg to require options + for what to reset. + - Improved reset method in Minion and Minion::Backend::Pg to allow for locks + to be reset without resetting the whole queue. + - Improved performance by making the minion_workers table unlogged. + +------------------------------------------------------------------- Old: ---- Minion-9.13.tar.gz New: ---- Minion-10.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Minion.spec ++++++ --- /var/tmp/diff_new_pack.1V9GW5/_old 2019-11-20 10:27:43.578568130 +0100 +++ /var/tmp/diff_new_pack.1V9GW5/_new 2019-11-20 10:27:43.582568131 +0100 @@ -17,7 +17,7 @@ Name: perl-Minion -Version: 9.13 +Version: 10.0 Release: 0 %define cpan_name Minion Summary: Job queue @@ -51,7 +51,7 @@ %prep %setup -q -n %{cpan_name}-%{version} -find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644 +find . -type f ! -path "*/t/*" ! -name "*.pl" ! -name "*.sh" ! -path "*/bin/*" ! -path "*/script/*" ! -name "configure" -print0 | xargs -0 chmod 644 %build perl Makefile.PL INSTALLDIRS=vendor ++++++ Minion-9.13.tar.gz -> Minion-10.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/.perltidyrc new/Minion-10.0/.perltidyrc --- old/Minion-9.13/.perltidyrc 1970-01-01 01:00:00.000000000 +0100 +++ new/Minion-10.0/.perltidyrc 2019-10-09 18:51:17.000000000 +0200 @@ -0,0 +1,14 @@ +-pbp # Start with Perl Best Practices +-w # Show all warnings +-iob # Ignore old breakpoints +-l=80 # 80 characters per line +-mbl=2 # No more than 2 blank lines +-i=2 # Indentation is 2 columns +-ci=2 # Continuation indentation is 2 columns +-vt=0 # Less vertical tightness +-pt=2 # High parenthesis tightness +-bt=2 # High brace tightness +-sbt=2 # High square bracket tightness +-wn # Weld nested containers +-isbc # Don't indent comments without leading space +-nst # Don't output to STDOUT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/Changes new/Minion-10.0/Changes --- old/Minion-9.13/Changes 2019-08-29 13:41:21.000000000 +0200 +++ new/Minion-10.0/Changes 2019-11-15 19:25:27.000000000 +0100 @@ -1,4 +1,20 @@ +10.0 2019-11-15 + - Removed PostgreSQL migrations older than 2 years, that means you need to + have Minion version 7.01 or newer installed before you can upgrade to + version 10.0. + - Removed experimental status from result_p method in Minion. + - Removed experimental status from history method in Minion and + Minion::Backend::Pg. + - Removed experimental status from delayed_jobs and enqueued_jobs fields from + stats methods in Minion and Minion::Backend::Pg. + - Removed experimental status from cleanup and finish events in Minion::Job. + - Changed reset method in Minion and Minion::Backend::Pg to require options + for what to reset. + - Improved reset method in Minion and Minion::Backend::Pg to allow for locks + to be reset without resetting the whole queue. + - Improved performance by making the minion_workers table unlogged. + 9.13 2019-08-29 - Added EXPERIMENTAL cleanup event to Minion::Job. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/MANIFEST new/Minion-10.0/MANIFEST --- old/Minion-9.13/MANIFEST 2019-08-29 13:42:04.000000000 +0200 +++ new/Minion-10.0/MANIFEST 2019-11-15 20:03:57.000000000 +0100 @@ -1,3 +1,4 @@ +.perltidyrc Changes examples/admin.png examples/linkcheck/lib/LinkCheck.pm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/META.json new/Minion-10.0/META.json --- old/Minion-9.13/META.json 2019-08-29 13:42:04.000000000 +0200 +++ new/Minion-10.0/META.json 2019-11-15 20:03:57.000000000 +0100 @@ -4,7 +4,7 @@ "Sebastian Riedel <[email protected]>" ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], @@ -54,6 +54,6 @@ }, "x_IRC" : "irc://irc.freenode.net/#mojo" }, - "version" : "9.13", + "version" : "10.0", "x_serialization_backend" : "JSON::PP version 4.04" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/META.yml new/Minion-10.0/META.yml --- old/Minion-9.13/META.yml 2019-08-29 13:42:04.000000000 +0200 +++ new/Minion-10.0/META.yml 2019-11-15 20:03:57.000000000 +0100 @@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -27,5 +27,5 @@ homepage: https://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/mojolicious/minion.git -version: '9.13' +version: '10.0' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/examples/minion_bench.pl new/Minion-10.0/examples/minion_bench.pl --- old/Minion-9.13/examples/minion_bench.pl 2019-08-05 00:52:33.000000000 +0200 +++ new/Minion-10.0/examples/minion_bench.pl 2019-11-14 22:42:10.000000000 +0100 @@ -18,16 +18,16 @@ my $minion = Minion->new(Pg => 'postgresql://[email protected]:5432/postgres'); $minion->add_task(foo => sub { }); $minion->add_task(bar => sub { }); -$minion->reset; +$minion->reset({all => 1}); # Enqueue say "Clean start with $ENQUEUE jobs"; my @parents = map { $minion->enqueue('foo') } 1 .. 5; -my $before = time; +my $before = time; $minion->enqueue($_ % 2 ? 'foo' : 'bar' => [] => {parents => \@parents}) for 1 .. $ENQUEUE; my $elapsed = time - $before; -my $avg = sprintf '%.3f', $ENQUEUE / $elapsed; +my $avg = sprintf '%.3f', $ENQUEUE / $elapsed; say "Enqueued $ENQUEUE jobs in $elapsed seconds ($avg/s)"; $minion->backend->pg->db->query('analyze minion_jobs'); @@ -42,7 +42,7 @@ my $before = time; $worker->dequeue(0.5)->finish for 1 .. $DEQUEUE; my $elapsed = time - $before; - my $avg = sprintf '%.3f', $DEQUEUE / $elapsed; + my $avg = sprintf '%.3f', $DEQUEUE / $elapsed; say "$$ finished $DEQUEUE jobs in $elapsed seconds ($avg/s)"; $worker->unregister; exit; @@ -54,7 +54,7 @@ my $before = time; waitpid $_, 0 for @pids; my $elapsed = time - $before; - my $avg = sprintf '%.3f', ($DEQUEUE * $WORKERS) / $elapsed; + my $avg = sprintf '%.3f', ($DEQUEUE * $WORKERS) / $elapsed; say "$WORKERS workers finished $DEQUEUE jobs each in $elapsed seconds ($avg/s)"; } @@ -66,7 +66,7 @@ my $backend = $minion->backend; $backend->list_jobs(0, 1, {ids => [$_]}) for 1 .. $INFO; $elapsed = time - $before; -$avg = sprintf '%.3f', $INFO / $elapsed; +$avg = sprintf '%.3f', $INFO / $elapsed; say "Received job info $INFO times in $elapsed seconds ($avg/s)"; # Stats @@ -74,7 +74,7 @@ $before = time; $minion->stats for 1 .. $STATS; $elapsed = time - $before; -$avg = sprintf '%.3f', $STATS / $elapsed; +$avg = sprintf '%.3f', $STATS / $elapsed; say "Received stats $STATS times in $elapsed seconds ($avg/s)"; # Repair @@ -82,7 +82,7 @@ $before = time; $minion->repair for 1 .. $REPAIR; $elapsed = time - $before; -$avg = sprintf '%.3f', $REPAIR / $elapsed; +$avg = sprintf '%.3f', $REPAIR / $elapsed; say "Repaired $REPAIR times in $elapsed seconds ($avg/s)"; # Lock @@ -91,7 +91,7 @@ $minion->lock($_ % 2 ? 'foo' : 'bar', 3600, {limit => int($LOCK / 2)}) for 1 .. $LOCK; $elapsed = time - $before; -$avg = sprintf '%.3f', $LOCK / $elapsed; +$avg = sprintf '%.3f', $LOCK / $elapsed; say "Acquired locks $LOCK times in $elapsed seconds ($avg/s)"; # Unlock @@ -99,5 +99,5 @@ $before = time; $minion->unlock($_ % 2 ? 'foo' : 'bar') for 1 .. $UNLOCK; $elapsed = time - $before; -$avg = sprintf '%.3f', $UNLOCK / $elapsed; +$avg = sprintf '%.3f', $UNLOCK / $elapsed; say "Releasing locks $UNLOCK times in $elapsed seconds ($avg/s)"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/lib/Minion/Backend/Pg.pm new/Minion-10.0/lib/Minion/Backend/Pg.pm --- old/Minion-9.13/lib/Minion/Backend/Pg.pm 2019-08-05 11:48:01.000000000 +0200 +++ new/Minion-10.0/lib/Minion/Backend/Pg.pm 2019-11-15 19:19:20.000000000 +0100 @@ -218,8 +218,13 @@ } sub reset { - shift->pg->db->query( - 'truncate minion_jobs, minion_locks, minion_workers restart identity'); + my ($self, $options) = (shift, shift // {}); + + if ($options->{all}) { + $self->pg->db->query( + 'truncate minion_jobs, minion_locks, minion_workers restart identity'); + } + elsif ($options->{locks}) { $self->pg->db->query('truncate minion_locks') } } sub retry_job { @@ -500,8 +505,7 @@ my $history = $backend->history; -Get history information for job queue. Note that this method is EXPERIMENTAL and -might change without warning! +Get history information for job queue. These fields are currently available: @@ -885,10 +889,28 @@ =head2 reset - $backend->reset; + $backend->reset({all => 1}); Reset job queue. +These options are currently available: + +=over 2 + +=item all + + all => 1 + +Reset everything. + +=item locks + + locks => 1 + +Reset only locks. + +=back + =head2 retry_job my $bool = $backend->retry_job($job_id, $retries); @@ -966,15 +988,13 @@ delayed_jobs => 100 Number of jobs in C<inactive> state that are scheduled to run at specific time -in the future. Note that this field is EXPERIMENTAL and might change without -warning! +in the future. =item enqueued_jobs enqueued_jobs => 100000 -Rough estimate of how many jobs have ever been enqueued. Note that this field is -EXPERIMENTAL and might change without warning! +Rough estimate of how many jobs have ever been enqueued. =item failed_jobs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/lib/Minion/Backend/resources/migrations/pg.sql new/Minion-10.0/lib/Minion/Backend/resources/migrations/pg.sql --- old/Minion-9.13/lib/Minion/Backend/resources/migrations/pg.sql 2019-08-05 11:46:54.000000000 +0200 +++ new/Minion-10.0/lib/Minion/Backend/resources/migrations/pg.sql 2019-11-14 21:04:44.000000000 +0100 @@ -3,64 +3,45 @@ -- used for upgrades to the latest version. Downgrades may be used to clean up -- the database, but they do not have to work with old versions of Minion. -- --- 1 up +-- 18 up +create type minion_state as enum ('inactive', 'active', 'failed', 'finished'); create table if not exists minion_jobs ( id bigserial not null primary key, - args json not null, - created timestamp with time zone not null, + args jsonb not null check(jsonb_typeof(args) = 'array'), + attempts int not null default 1, + created timestamp with time zone not null default now(), delayed timestamp with time zone not null, finished timestamp with time zone, + notes jsonb check(jsonb_typeof(notes) = 'object') not null default '{}', + parents bigint[] not null default '{}', priority int not null, - result json, + queue text not null default 'default', + result jsonb, retried timestamp with time zone, - retries int not null, + retries int not null default 0, started timestamp with time zone, - state text not null, + state minion_state not null default 'inactive'::minion_state, task text not null, worker bigint ); +create index on minion_jobs (state, priority desc, id); +create index on minion_jobs using gin (parents); create table if not exists minion_workers ( + id bigserial not null primary key, + host text not null, + inbox jsonb check(jsonb_typeof(inbox) = 'array') not null default '[]', + notified timestamp with time zone not null default now(), + pid int not null, + started timestamp with time zone not null default now(), + status jsonb check(jsonb_typeof(status) = 'object') not null default '{}' +); +create unlogged table if not exists minion_locks ( id bigserial not null primary key, - host text not null, - pid int not null, - started timestamp with time zone not null + name text not null, + expires timestamp with time zone not null ); +create index on minion_locks (name, expires); --- 1 down -drop table if exists minion_jobs; -drop table if exists minion_workers; - --- 2 up -alter table minion_jobs alter column created set default now(); -alter table minion_jobs alter column state set default 'inactive'; -alter table minion_jobs alter column retries set default 0; -alter table minion_workers add column - notified timestamp with time zone not null default now(); -alter table minion_workers alter column started set default now(); - --- 4 up -alter table minion_jobs add column queue text not null default 'default'; - --- 5 up -alter table minion_jobs add column attempts int not null default 1; - --- 7 up -create type minion_state as enum ('inactive', 'active', 'failed', 'finished'); -alter table minion_jobs alter column state set default 'inactive'::minion_state; -alter table minion_jobs - alter column state type minion_state using state::minion_state; -alter table minion_jobs alter column args type jsonb using args::jsonb; -alter table minion_jobs alter column result type jsonb using result::jsonb; - --- 7 down -alter table minion_jobs alter column state type text using state; -alter table minion_jobs alter column state set default 'inactive'; -drop type if exists minion_state; - --- 8 up -alter table minion_jobs add constraint args check(jsonb_typeof(args) = 'array'); - --- 9 up create or replace function minion_jobs_notify_workers() returns trigger as $$ begin if new.delayed <= now() then @@ -69,50 +50,10 @@ return null; end; $$ language plpgsql; -set client_min_messages to warning; -drop trigger if exists minion_jobs_insert_trigger on minion_jobs; -drop trigger if exists minion_jobs_notify_workers_trigger on minion_jobs; -set client_min_messages to notice; create trigger minion_jobs_notify_workers_trigger after insert or update of retries on minion_jobs for each row execute procedure minion_jobs_notify_workers(); --- 9 down -drop trigger if exists minion_jobs_notify_workers_trigger on minion_jobs; -drop function if exists minion_jobs_notify_workers(); - --- 10 up -alter table minion_jobs add column parents bigint[] not null default '{}'; - --- 11 up -create index on minion_jobs (state, priority desc, id); - --- 12 up -alter table minion_workers add column inbox jsonb - check(jsonb_typeof(inbox) = 'array') not null default '[]'; - --- 15 up -alter table minion_workers add column status jsonb - check(jsonb_typeof(status) = 'object') not null default '{}'; - --- 16 up -create index on minion_jobs using gin (parents); -create table if not exists minion_locks ( - id bigserial not null primary key, - name text not null, - expires timestamp with time zone not null -); - --- 16 down -drop table if exists minion_locks; - --- 17 up -alter table minion_jobs add column notes jsonb - check(jsonb_typeof(notes) = 'object') not null default '{}'; -alter table minion_locks set unlogged; -create index on minion_locks (name, expires); - --- 18 up create or replace function minion_lock(text, int, int) returns bool as $$ declare new_expires timestamp with time zone = now() + (interval '1 second' * $2); @@ -130,7 +71,16 @@ $$ language plpgsql; -- 18 down +drop table if exists minion_jobs; +drop table if exists minion_workers; +drop table if exists minion_locks; +drop type if exists minion_state; +drop trigger if exists minion_jobs_notify_workers_trigger on minion_jobs; +drop function if exists minion_jobs_notify_workers(); drop function if exists minion_lock(text, int, int); -- 19 up create index on minion_jobs using gin (notes); + +-- 20 up +alter table minion_workers set unlogged; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/lib/Minion/Backend.pm new/Minion-10.0/lib/Minion/Backend.pm --- old/Minion-9.13/lib/Minion/Backend.pm 2019-08-05 00:22:22.000000000 +0200 +++ new/Minion-10.0/lib/Minion/Backend.pm 2019-11-15 19:20:16.000000000 +0100 @@ -5,15 +5,12 @@ has minion => undef, weak => 1; -sub broadcast { croak 'Method "broadcast" not implemented by subclass' } -sub dequeue { croak 'Method "dequeue" not implemented by subclass' } -sub enqueue { croak 'Method "enqueue" not implemented by subclass' } -sub fail_job { croak 'Method "fail_job" not implemented by subclass' } -sub finish_job { croak 'Method "finish_job" not implemented by subclass' } - -# TODO: This method will croak after the experimentation period -sub history { {daily => []} } - +sub broadcast { croak 'Method "broadcast" not implemented by subclass' } +sub dequeue { croak 'Method "dequeue" not implemented by subclass' } +sub enqueue { croak 'Method "enqueue" not implemented by subclass' } +sub fail_job { croak 'Method "fail_job" not implemented by subclass' } +sub finish_job { croak 'Method "finish_job" not implemented by subclass' } +sub history { croak 'Method "history" not implemented by subclass' } sub list_jobs { croak 'Method "list_jobs" not implemented by subclass' } sub list_locks { croak 'Method "list_locks" not implemented by subclass' } sub list_workers { croak 'Method "list_workers" not implemented by subclass' } @@ -235,7 +232,6 @@ my $history = $backend->history; Get history information for job queue. Meant to be overloaded in a subclass. -Note that this method is EXPERIMENTAL and might change without warning! These fields are currently available: @@ -620,10 +616,28 @@ =head2 reset - $backend->reset; + $backend->reset({all => 1}); Reset job queue. Meant to be overloaded in a subclass. +These options are currently available: + +=over 2 + +=item all + + all => 1 + +Reset everything. + +=item locks + + locks => 1 + +Reset only locks. + +=back + =head2 retry_job my $bool = $backend->retry_job($job_id, $retries); @@ -701,8 +715,13 @@ delayed_jobs => 100 Number of jobs in C<inactive> state that are scheduled to run at specific time -in the future or have unresolved dependencies. Note that this field is -EXPERIMENTAL and might change without warning! +in the future or have unresolved dependencies. + +=item enqueued_jobs + + enqueued_jobs => 100000 + +Rough estimate of how many jobs have ever been enqueued. =item failed_jobs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/lib/Minion/Job.pm new/Minion-10.0/lib/Minion/Job.pm --- old/Minion-9.13/lib/Minion/Job.pm 2019-08-29 13:40:41.000000000 +0200 +++ new/Minion-10.0/lib/Minion/Job.pm 2019-11-15 19:25:08.000000000 +0100 @@ -119,10 +119,9 @@ }); Emitted in the process performing this job right before the process will exit. -Note that this event is EXPERIMENTAL and might change without warning! $job->on(cleanup => sub { - my $job = shift; + my $job = shift; $job->app->log->debug("Process $$ is about to exit"); }); @@ -148,8 +147,7 @@ ... }); -Emitted in the process performing this job if the task was successful. Note that -this event is EXPERIMENTAL and might change without warning! +Emitted in the process performing this job if the task was successful. $job->on(finish => sub { my $job = shift; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/lib/Minion.pm new/Minion-10.0/lib/Minion.pm --- old/Minion-9.13/lib/Minion.pm 2019-08-05 11:50:52.000000000 +0200 +++ new/Minion-10.0/lib/Minion.pm 2019-11-15 19:24:44.000000000 +0100 @@ -22,7 +22,7 @@ has remove_after => 172800; has tasks => sub { {} }; -our $VERSION = '9.13'; +our $VERSION = '10.0'; sub add_task { ($_[0]->tasks->{$_[1]} = $_[2]) and return $_[0] } @@ -97,7 +97,8 @@ } sub repair { shift->_delegate('repair') } -sub reset { shift->_delegate('reset') } + +sub reset { shift->_delegate('reset', @_) } sub result_p { my ($self, $id, $options) = (shift, shift, shift // {}); @@ -136,8 +137,8 @@ } sub _delegate { - my ($self, $method) = @_; - $self->backend->$method; + my ($self, $method) = (shift, shift); + $self->backend->$method(@_); return $self; } @@ -363,8 +364,7 @@ $minion->on(worker => sub { my ($minion, $worker) = @_; - my $id = $worker->id; - say "Worker $$:$id started."; + say "Worker $$ started."; }); =head1 ATTRIBUTES @@ -556,8 +556,7 @@ my $history = $minion->history; -Get history information for job queue. Note that this method is EXPERIMENTAL and -might change without warning! +Get history information for job queue. These fields are currently available: @@ -681,10 +680,28 @@ =head2 reset - $minion = $minion->reset; + $minion = $minion->reset({all => 1}); Reset job queue. +These options are currently available: + +=over 2 + +=item all + + all => 1 + +Reset everything. + +=item locks + + locks => 1 + +Reset only locks. + +=back + =head2 result_p my $promise = $minion->result_p($id); @@ -693,8 +710,7 @@ Return a L<Mojo::Promise> object for the result of a job. The state C<finished> will result in the promise being C<fullfilled>, and the state C<failed> in the promise being C<rejected>. This operation can be cancelled by resolving the -promise manually at any time. Note that this method is EXPERIMENTAL and might -change without warning! +promise manually at any time. # Enqueue job and receive the result at some point in the future my $id = $minion->enqueue('foo'); @@ -756,8 +772,7 @@ delayed_jobs => 100 Number of jobs in C<inactive> state that are scheduled to run at specific time -in the future or have unresolved dependencies. Note that this field is -EXPERIMENTAL and might change without warning! +in the future or have unresolved dependencies. =item enqueued_jobs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/lib/Mojolicious/Plugin/Minion/Admin.pm new/Minion-10.0/lib/Mojolicious/Plugin/Minion/Admin.pm --- old/Minion-9.13/lib/Mojolicious/Plugin/Minion/Admin.pm 2019-05-31 21:45:14.000000000 +0200 +++ new/Minion-10.0/lib/Mojolicious/Plugin/Minion/Admin.pm 2019-11-15 13:13:05.000000000 +0100 @@ -43,15 +43,13 @@ my $c = shift; my $v = $c->validation; - $v->optional('id'); + $v->optional($_) for qw(id note queue task); $v->optional('limit')->num; $v->optional('offset')->num; - $v->optional('queue'); $v->optional('state')->in(qw(active failed finished inactive)); - $v->optional('task'); my $options = {}; $v->is_valid($_) && ($options->{"${_}s"} = $v->every_param($_)) - for qw(id queue state task); + for qw(id note queue state task); my $limit = $v->param('limit') || 10; my $offset = $v->param('offset') || 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/t/backend.t new/Minion-10.0/t/backend.t --- old/Minion-9.13/t/backend.t 2019-05-31 21:44:55.000000000 +0200 +++ new/Minion-10.0/t/backend.t 2019-11-15 19:17:49.000000000 +0100 @@ -14,6 +14,8 @@ like $@, qr/Method "fail_job" not implemented by subclass/, 'right error'; eval { Minion::Backend->finish_job }; like $@, qr/Method "finish_job" not implemented by subclass/, 'right error'; +eval { Minion::Backend->history }; +like $@, qr/Method "history" not implemented by subclass/, 'right error'; eval { Minion::Backend->list_jobs }; like $@, qr/Method "list_jobs" not implemented by subclass/, 'right error'; eval { Minion::Backend->list_locks }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-9.13/t/pg.t new/Minion-10.0/t/pg.t --- old/Minion-9.13/t/pg.t 2019-08-29 13:40:02.000000000 +0200 +++ new/Minion-10.0/t/pg.t 2019-11-15 12:02:04.000000000 +0100 @@ -24,11 +24,11 @@ isa_ok $worker->minion->app, 'Mojolicious', 'has default application'; # Migrate up and down -is $minion->backend->pg->migrations->active, 19, 'active version is 19'; +is $minion->backend->pg->migrations->active, 20, 'active version is 20'; is $minion->backend->pg->migrations->migrate(0)->active, 0, 'active version is 0'; -is $minion->backend->pg->migrations->migrate->active, 19, - 'active version is 19'; +is $minion->backend->pg->migrations->migrate->active, 20, + 'active version is 20'; # Register and unregister $worker->register; @@ -52,7 +52,7 @@ my (@finished, @failed); my $promise = $minion->result_p($id, {interval => 0})->then(sub { @finished = @_ }) - ->catch(sub { @failed = @_ }); + ->catch(sub { @failed = @_ }); my $job = $worker->dequeue(0); is $job->id, $id, 'same id'; Mojo::IOLoop->one_tick; @@ -69,7 +69,7 @@ my $id2 = $minion->enqueue('test'); $promise = $minion->result_p($id2, {interval => 0})->then(sub { @finished = @_ }) - ->catch(sub { @failed = @_ }); + ->catch(sub { @failed = @_ }); $job = $worker->dequeue(0); is $job->id, $id2, 'same id'; $job->fail({works => 'too!'}); @@ -217,7 +217,7 @@ ok !$minion->lock('foo', 3600), 'not locked again'; ok $minion->unlock('foo'), 'unlocked'; ok !$minion->unlock('foo'), 'not unlocked again'; -ok $minion->lock('yada', 3600, {limit => 1}), 'locked'; +ok $minion->lock('yada', 3600, {limit => 1}), 'locked'; ok !$minion->lock('yada', 3600, {limit => 1}), 'not locked again'; # Shared lock @@ -226,7 +226,7 @@ ok $minion->lock('bar', -3600, {limit => 3}), 'locked again'; ok $minion->lock('bar', 3600, {limit => 3}), 'locked again'; ok !$minion->lock('bar', 3600, {limit => 2}), 'not locked again'; -ok $minion->lock('baz', 3600, {limit => 3}), 'locked'; +ok $minion->lock('baz', 3600, {limit => 3}), 'locked'; ok $minion->unlock('bar'), 'unlocked'; ok $minion->lock('bar', 3600, {limit => 3}), 'locked again'; ok $minion->unlock('bar'), 'unlocked again'; @@ -286,14 +286,26 @@ undef $guard; undef $guard3; -# Reset -$minion->reset->repair; -ok !$minion->backend->pg->db->query( - 'select count(id) as count from minion_jobs')->hash->{count}, 'no jobs'; -ok !$minion->backend->pg->db->query( - 'select count(id) as count from minion_locks')->hash->{count}, 'no locks'; -ok !$minion->backend->pg->db->query( - 'select count(id) as count from minion_workers')->hash->{count}, 'no workers'; +# Reset (locks) +$minion->lock('test', 3600); +$minion->worker->register; +ok $minion->backend->list_jobs(0, 1)->{total}, 'jobs'; +ok $minion->backend->list_locks(0, 1)->{total}, 'locks'; +ok $minion->backend->list_workers(0, 1)->{total}, 'workers'; +$minion->reset({locks => 1}); +ok $minion->backend->list_jobs(0, 1)->{total}, 'jobs'; +ok !$minion->backend->list_locks(0, 1)->{total}, 'no locks'; +ok $minion->backend->list_workers(0, 1)->{total}, 'workers'; + +# Reset (all) +$minion->lock('test', 3600); +ok $minion->backend->list_jobs(0, 1)->{total}, 'jobs'; +ok $minion->backend->list_locks(0, 1)->{total}, 'locks'; +ok $minion->backend->list_workers(0, 1)->{total}, 'workers'; +$minion->reset({all => 1})->repair; +ok !$minion->backend->list_jobs(0, 1)->{total}, 'no jobs'; +ok !$minion->backend->list_locks(0, 1)->{total}, 'no locks'; +ok !$minion->backend->list_workers(0, 1)->{total}, 'no workers'; # Stats $minion->add_task( @@ -422,7 +434,7 @@ is $batch->[2]{queue}, 'default', 'right queue'; is $batch->[3]{queue}, 'default', 'right queue'; ok !$batch->[4], 'no more results'; -$id2 = $minion->enqueue('test' => [] => {notes => {is_test => 1}}); +$id2 = $minion->enqueue('test' => [] => {notes => {is_test => 1}}); $batch = $minion->backend->list_jobs(0, 10, {notes => ['is_test']})->{jobs}; is $batch->[0]{task}, 'test', 'right task'; ok !$batch->[4], 'no more results';
