Hello community,
here is the log from the commit of package perl-Minion-Backend-SQLite for
openSUSE:Factory checked in at 2020-07-28 17:29:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Minion-Backend-SQLite (Old)
and /work/SRC/openSUSE:Factory/.perl-Minion-Backend-SQLite.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Minion-Backend-SQLite"
Tue Jul 28 17:29:24 2020 rev:7 rq:823160 version:5.0.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Minion-Backend-SQLite/perl-Minion-Backend-SQLite.changes
2020-06-22 17:45:12.809713924 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Minion-Backend-SQLite.new.3592/perl-Minion-Backend-SQLite.changes
2020-07-28 17:30:07.098230131 +0200
@@ -1,0 +2,13 @@
+Tue Jul 28 09:45:49 UTC 2020 - Tina Müller <[email protected]>
+
+- updated to 5.0.2
+ see /usr/share/doc/packages/perl-Minion-Backend-SQLite/Changes
+
+ v5.0.2 2020-07-23 00:30:45 EDT
+ - Minion requirement bumped to 10.10.
+ - Support removing stuck jobs in repair method.
+ - Added EXPERIMENTAL sequence option to enqueue method and sequences
option to list_jobs method
+ to support job sequences.
+ - Added next and previous fields to list_jobs method.
+
+-------------------------------------------------------------------
Old:
----
Minion-Backend-SQLite-v5.0.1.tar.gz
New:
----
Minion-Backend-SQLite-v5.0.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Minion-Backend-SQLite.spec ++++++
--- /var/tmp/diff_new_pack.WW1nBN/_old 2020-07-28 17:30:09.294232622 +0200
+++ /var/tmp/diff_new_pack.WW1nBN/_new 2020-07-28 17:30:09.298232627 +0200
@@ -17,7 +17,7 @@
Name: perl-Minion-Backend-SQLite
-Version: 5.0.1
+Version: 5.0.2
Release: 0
%define cpan_name Minion-Backend-SQLite
Summary: SQLite backend for Minion job queue
@@ -30,13 +30,13 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
-BuildRequires: perl(Minion) >= 10.03
+BuildRequires: perl(Minion) >= 10.10
BuildRequires: perl(Module::Build::Tiny) >= 0.034
BuildRequires: perl(Module::Metadata)
BuildRequires: perl(Mojo::SQLite) >= 3.000
BuildRequires: perl(Mojolicious) >= 7.29
BuildRequires: perl(Test::More) >= 0.96
-Requires: perl(Minion) >= 10.03
+Requires: perl(Minion) >= 10.10
Requires: perl(Mojo::SQLite) >= 3.000
Requires: perl(Mojolicious) >= 7.29
%{perl_requires}
@@ -63,7 +63,7 @@
%files -f %{name}.files
%defattr(-,root,root,755)
-%doc Changes CONTRIBUTING.md examples README
+%doc Changes CONTRIBUTING.md examples prereqs.yml README
%license LICENSE
%changelog
++++++ Minion-Backend-SQLite-v5.0.1.tar.gz ->
Minion-Backend-SQLite-v5.0.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/Build.PL
new/Minion-Backend-SQLite-v5.0.2/Build.PL
--- old/Minion-Backend-SQLite-v5.0.1/Build.PL 2020-06-18 05:20:48.000000000
+0200
+++ new/Minion-Backend-SQLite-v5.0.2/Build.PL 2020-07-23 06:30:48.000000000
+0200
@@ -68,7 +68,7 @@
}
- # This section was automatically generated by
Dist::Zilla::Plugin::ModuleBuild v6.014.
+ # This section was automatically generated by
Dist::Zilla::Plugin::ModuleBuild v6.015.
use strict;
use warnings;
@@ -84,13 +84,13 @@
"Dan Book <dbook\@cpan.org>"
],
"dist_name" => "Minion-Backend-SQLite",
- "dist_version" => "v5.0.1",
+ "dist_version" => "v5.0.2",
"license" => "artistic_2",
"module_name" => "Minion::Backend::SQLite",
"recursive_test_files" => 1,
"requires" => {
"List::Util" => 0,
- "Minion" => "10.03",
+ "Minion" => "10.10",
"Mojo::SQLite" => "3.000",
"Mojolicious" => "7.29",
"Sys::Hostname" => 0,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/Changes
new/Minion-Backend-SQLite-v5.0.2/Changes
--- old/Minion-Backend-SQLite-v5.0.1/Changes 2020-06-18 05:20:48.000000000
+0200
+++ new/Minion-Backend-SQLite-v5.0.2/Changes 2020-07-23 06:30:48.000000000
+0200
@@ -1,3 +1,10 @@
+v5.0.2 2020-07-23 00:30:45 EDT
+ - Minion requirement bumped to 10.10.
+ - Support removing stuck jobs in repair method.
+ - Added EXPERIMENTAL sequence option to enqueue method and sequences option
to list_jobs method
+ to support job sequences.
+ - Added next and previous fields to list_jobs method.
+
v5.0.1 2020-06-17 23:20:46 EDT
- Fixed tests to be less sensitive to error message contents.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/MANIFEST
new/Minion-Backend-SQLite-v5.0.2/MANIFEST
--- old/Minion-Backend-SQLite-v5.0.1/MANIFEST 2020-06-18 05:20:48.000000000
+0200
+++ new/Minion-Backend-SQLite-v5.0.2/MANIFEST 2020-07-23 06:30:48.000000000
+0200
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest
v6.014.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest
v6.015.
Build.PL
CONTRIBUTING.md
Changes
@@ -8,10 +8,10 @@
META.json
META.yml
README
-cpanfile
dist.ini
examples/minion_bench.pl
lib/Minion/Backend/SQLite.pm
+prereqs.yml
t/00-report-prereqs.dd
t/00-report-prereqs.t
t/sqlite.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/META.json
new/Minion-Backend-SQLite-v5.0.2/META.json
--- old/Minion-Backend-SQLite-v5.0.1/META.json 2020-06-18 05:20:48.000000000
+0200
+++ new/Minion-Backend-SQLite-v5.0.2/META.json 2020-07-23 06:30:48.000000000
+0200
@@ -4,7 +4,7 @@
"Dan Book <[email protected]>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 6.014, CPAN::Meta::Converter version
2.150010",
+ "generated_by" : "Dist::Zilla version 6.015, CPAN::Meta::Converter version
2.150010",
"license" : [
"artistic_2"
],
@@ -39,7 +39,7 @@
"runtime" : {
"requires" : {
"List::Util" : "0",
- "Minion" : "10.03",
+ "Minion" : "10.10",
"Mojo::SQLite" : "3.000",
"Mojolicious" : "7.29",
"Sys::Hostname" : "0",
@@ -64,7 +64,7 @@
"provides" : {
"Minion::Backend::SQLite" : {
"file" : "lib/Minion/Backend/SQLite.pm",
- "version" : "v5.0.1"
+ "version" : "v5.0.2"
}
},
"release_status" : "stable",
@@ -80,7 +80,7 @@
},
"x_IRC" : "irc://irc.freenode.net/#mojo"
},
- "version" : "v5.0.1",
+ "version" : "v5.0.2",
"x_contributors" : [
"Dan Book <[email protected]>",
"yrjustice <[email protected]>"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/META.yml
new/Minion-Backend-SQLite-v5.0.2/META.yml
--- old/Minion-Backend-SQLite-v5.0.1/META.yml 2020-06-18 05:20:48.000000000
+0200
+++ new/Minion-Backend-SQLite-v5.0.2/META.yml 2020-07-23 06:30:48.000000000
+0200
@@ -9,7 +9,7 @@
configure_requires:
Module::Build::Tiny: '0.034'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 6.014, CPAN::Meta::Converter version
2.150010'
+generated_by: 'Dist::Zilla version 6.015, CPAN::Meta::Converter version
2.150010'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -26,10 +26,10 @@
provides:
Minion::Backend::SQLite:
file: lib/Minion/Backend/SQLite.pm
- version: v5.0.1
+ version: v5.0.2
requires:
List::Util: '0'
- Minion: '10.03'
+ Minion: '10.10'
Mojo::SQLite: '3.000'
Mojolicious: '7.29'
Sys::Hostname: '0'
@@ -40,7 +40,7 @@
bugtracker: https://github.com/Grinnz/Minion-Backend-SQLite/issues
homepage: https://github.com/Grinnz/Minion-Backend-SQLite
repository: https://github.com/Grinnz/Minion-Backend-SQLite.git
-version: v5.0.1
+version: v5.0.2
x_contributors:
- 'Dan Book <[email protected]>'
- 'yrjustice <[email protected]>'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/README
new/Minion-Backend-SQLite-v5.0.2/README
--- old/Minion-Backend-SQLite-v5.0.1/README 2020-06-18 05:20:48.000000000
+0200
+++ new/Minion-Backend-SQLite-v5.0.2/README 2020-07-23 06:30:48.000000000
+0200
@@ -169,6 +169,14 @@
Queue to put job in, defaults to default.
+ sequence
+
+ sequence => 'host:mojolicious.org'
+
+ Sequence this job belongs to. The previous job from the sequence will
+ be automatically added as a parent to continue the sequence. Note
+ that this option is EXPERIMENTAL and might change without warning!
+
fail_job
my $bool = $backend->fail_job($job_id, $retries);
@@ -240,6 +248,13 @@
List only jobs in these queues.
+ sequences
+
+ sequences => ['host:localhost', 'host:mojolicious.org']
+
+ List only jobs from these sequences. Note that this option is
+ EXPERIMENTAL and might change without warning!
+
states
states => ['inactive', 'active']
@@ -296,6 +311,12 @@
Job id.
+ next
+
+ next => 10024
+
+ Next job in sequence.
+
notes
notes => {foo => 'bar', baz => [1, 2, 3]}
@@ -308,6 +329,12 @@
Jobs this job depends on.
+ previous
+
+ previous => 10022
+
+ Previous job in sequence.
+
priority
priority => 3
@@ -338,6 +365,12 @@
Number of times job has been retried.
+ sequence
+
+ sequence => 'host:mojolicious.org'
+
+ Sequence name.
+
started
started => 784111777
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/cpanfile
new/Minion-Backend-SQLite-v5.0.2/cpanfile
--- old/Minion-Backend-SQLite-v5.0.1/cpanfile 2020-06-18 05:20:48.000000000
+0200
+++ new/Minion-Backend-SQLite-v5.0.2/cpanfile 1970-01-01 01:00:00.000000000
+0100
@@ -1,9 +0,0 @@
-requires 'perl' => '5.010001';
-requires 'List::Util';
-requires 'Minion' => '10.03';
-requires 'Mojolicious' => '7.29';
-requires 'Mojo::SQLite' => '3.000';
-requires 'Sys::Hostname';
-requires 'Time::HiRes';
-suggests 'Mojo::JSON::MaybeXS';
-test_requires 'Test::More' => '0.96';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/dist.ini
new/Minion-Backend-SQLite-v5.0.2/dist.ini
--- old/Minion-Backend-SQLite-v5.0.1/dist.ini 2020-06-18 05:20:48.000000000
+0200
+++ new/Minion-Backend-SQLite-v5.0.2/dist.ini 2020-07-23 06:30:48.000000000
+0200
@@ -5,7 +5,7 @@
copyright_year = 2015
[@Author::DBOOK]
-:version = 0.032
+:version = v1.0.3
installer = ModuleBuildTiny::Fallback
irc = irc://irc.freenode.net/#mojo
pod_tests = 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Minion-Backend-SQLite-v5.0.1/lib/Minion/Backend/SQLite.pm
new/Minion-Backend-SQLite-v5.0.2/lib/Minion/Backend/SQLite.pm
--- old/Minion-Backend-SQLite-v5.0.1/lib/Minion/Backend/SQLite.pm
2020-06-18 05:20:48.000000000 +0200
+++ new/Minion-Backend-SQLite-v5.0.2/lib/Minion/Backend/SQLite.pm
2020-07-23 06:30:48.000000000 +0200
@@ -8,7 +8,7 @@
use Sys::Hostname 'hostname';
use Time::HiRes 'usleep';
-our $VERSION = 'v5.0.1';
+our $VERSION = 'v5.0.2';
has dequeue_interval => 0.5;
has 'sqlite';
@@ -48,15 +48,17 @@
my ($self, $task, $args, $options) = (shift, shift, shift || [], shift ||
{});
my $db = $self->sqlite->db;
- return $db->query(
- q{insert into minion_jobs
- (args, attempts, delayed, notes, parents, priority, queue, task)
- values (?, ?, (datetime('now', ? || ' seconds')), ?, ?, ?, ?, ?)},
- {json => $args}, $options->{attempts} // 1,
- $options->{delay} // 0, {json => $options->{notes} || {}},
- {json => ($options->{parents} || [])}, $options->{priority} // 0,
- $options->{queue} // 'default', $task
- )->last_insert_id;
+ return _enqueue($db, $task, $args, $options) unless my $seq =
$options->{sequence};
+
+ my $tx = $db->begin('exclusive');
+ my $prev = $db->query(
+ q{select id from minion_jobs where sequence = ? and next is null limit 1},
$seq)
+ ->hashes->first;
+ unshift @{$options->{parents}}, $prev->{id} if $prev;
+ my $id = _enqueue($db, $task, $args, $options);
+ $db->query(q{update minion_jobs set next = ? where id = ?}, $id,
$prev->{id}) if $prev;
+ $tx->commit;
+ return $id;
}
sub fail_job { shift->_update(1, @_) }
@@ -120,6 +122,11 @@
push @where, @$queues ? "queue in ($queues_in)" : 'queue is null';
push @where_params, @$queues;
}
+ if (defined(my $sequences = $options->{sequences})) {
+ my $sequences_in = join ',', ('?')x@$sequences;
+ push @where, @$sequences ? "sequence in ($sequences_in)" : 'sequence is
null';
+ push @where_params, @$sequences;
+ }
if (defined(my $states = $options->{states})) {
my $states_in = join ',', ('?')x@$states;
push @where, @$states ? "state in ($states_in)" : 'state is null';
@@ -138,11 +145,11 @@
(select json_group_array(distinct child.id)
from minion_jobs as child, json_each(child.parents) as parent_id
where j.id = parent_id.value) as children,
- strftime('%s',created) as created,
- strftime('%s',delayed) as delayed,
- strftime('%s',finished) as finished, notes, parents, priority, queue,
- result, strftime('%s',retried) as retried, retries,
- strftime('%s',started) as started, state, task,
+ strftime('%s',created) as created, strftime('%s',delayed) as delayed,
+ strftime('%s',finished) as finished, next, notes, parents,
+ (select id from minion_jobs where sequence = j.sequence and next =
j.id) as previous,
+ priority, queue, result, strftime('%s',retried) as retried, retries,
+ sequence, strftime('%s',started) as started, state, task,
strftime('%s','now') as time, worker
from minion_jobs as j
$where_str order by id desc limit ? offset ?},
@@ -303,6 +310,12 @@
)->hashes;
$fail->each(sub { $self->fail_job(@$_{qw(id retries)}, 'Worker went away')
});
+ # Jobs in queue without workers or not enough workers (cannot be retried and
requires admin attention)
+ $db->query(
+ q{update minion_jobs set state = 'failed', result = json_quote('Job
appears stuck in queue')
+ where state = 'inactive' and delayed < datetime('now', '-' || ? || '
seconds')},
+ $minion->stuck_after);
+
# Old jobs with no unresolved dependencies
$db->query(
q{delete from minion_jobs
@@ -383,6 +396,20 @@
shift->sqlite->db->query('delete from minion_workers where id = ?', shift);
}
+sub _enqueue {
+ my ($db, $task, $args, $options) = @_;
+
+ return $db->query(
+ q{insert into minion_jobs
+ (args, attempts, delayed, notes, parents, priority, queue, sequence,
task)
+ values (?, ?, (datetime('now', ? || ' seconds')), ?, ?, ?, ?, ?, ?)},
+ {json => $args}, $options->{attempts} // 1,
+ $options->{delay} // 0, {json => $options->{notes} || {}},
+ {json => ($options->{parents} || [])}, $options->{priority} // 0,
+ $options->{queue} // 'default', $options->{sequence}, $task
+ )->last_insert_id;
+}
+
sub _try {
my ($self, $id, $options) = @_;
@@ -623,6 +650,14 @@
Queue to put job in, defaults to C<default>.
+=item sequence
+
+ sequence => 'host:mojolicious.org'
+
+Sequence this job belongs to. The previous job from the sequence will be
+automatically added as a parent to continue the sequence. Note that this option
+is B<EXPERIMENTAL> and might change without warning!
+
=back
=head2 fail_job
@@ -702,6 +737,13 @@
List only jobs in these queues.
+=item sequences
+
+ sequences => ['host:localhost', 'host:mojolicious.org']
+
+List only jobs from these sequences. Note that this option is B<EXPERIMENTAL>
+and might change without warning!
+
=item states
states => ['inactive', 'active']
@@ -762,6 +804,12 @@
Job id.
+=item next
+
+ next => 10024
+
+Next job in sequence.
+
=item notes
notes => {foo => 'bar', baz => [1, 2, 3]}
@@ -774,6 +822,12 @@
Jobs this job depends on.
+=item previous
+
+ previous => 10022
+
+Previous job in sequence.
+
=item priority
priority => 3
@@ -804,6 +858,12 @@
Number of times job has been retried.
+=item sequence
+
+ sequence => 'host:mojolicious.org'
+
+Sequence name.
+
=item started
started => 784111777
@@ -1291,3 +1351,9 @@
-- 8 down
drop table if exists minion_locks;
+
+-- 9 up
+alter table minion_jobs add column sequence text;
+alter table minion_jobs add column next integer;
+create unique index minion_jobs_next on minion_jobs (next);
+create index minion_jobs_sequence_next on minion_jobs (sequence, next);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/prereqs.yml
new/Minion-Backend-SQLite-v5.0.2/prereqs.yml
--- old/Minion-Backend-SQLite-v5.0.1/prereqs.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/Minion-Backend-SQLite-v5.0.2/prereqs.yml 2020-07-23
06:30:48.000000000 +0200
@@ -0,0 +1,14 @@
+runtime:
+ requires:
+ perl: '5.010001'
+ List::Util: 0
+ Minion: '10.10'
+ Mojolicious: '7.29'
+ Mojo::SQLite: '3.000'
+ Sys::Hostname: 0
+ Time::HiRes: 0
+ suggests:
+ Mojo::JSON::MaybeXS: 0
+test:
+ requires:
+ Test::More: '0.96'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/t/00-report-prereqs.dd
new/Minion-Backend-SQLite-v5.0.2/t/00-report-prereqs.dd
--- old/Minion-Backend-SQLite-v5.0.1/t/00-report-prereqs.dd 2020-06-18
05:20:48.000000000 +0200
+++ new/Minion-Backend-SQLite-v5.0.2/t/00-report-prereqs.dd 2020-07-23
06:30:48.000000000 +0200
@@ -14,7 +14,7 @@
'runtime' => {
'requires' => {
'List::Util' => '0',
- 'Minion' => '10.03',
+ 'Minion' => '10.10',
'Mojo::SQLite' => '3.000',
'Mojolicious' => '7.29',
'Sys::Hostname' => '0',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Minion-Backend-SQLite-v5.0.1/t/sqlite.t
new/Minion-Backend-SQLite-v5.0.2/t/sqlite.t
--- old/Minion-Backend-SQLite-v5.0.1/t/sqlite.t 2020-06-18 05:20:48.000000000
+0200
+++ new/Minion-Backend-SQLite-v5.0.2/t/sqlite.t 2020-07-23 06:30:48.000000000
+0200
@@ -21,9 +21,9 @@
};
subtest 'Migrate up and down' => sub {
- is $minion->backend->sqlite->migrations->active, 8, 'active version is 8';
+ is $minion->backend->sqlite->migrations->active, 9, 'active version is 9';
is $minion->backend->sqlite->migrations->migrate(0)->active, 0, 'active
version is 0';
- is $minion->backend->sqlite->migrations->migrate->active, 8, 'active version
is 8';
+ is $minion->backend->sqlite->migrations->migrate->active, 9, 'active version
is 9';
};
subtest 'Register and unregister' => sub {
@@ -171,6 +171,34 @@
ok !$minion->job($id3), 'job has been cleaned up';
};
+subtest 'Repair stuck jobs' => sub {
+ plan skip_all => 'Minion workers do not support fork emulation' if
HAS_PSEUDOFORK;
+ my $worker = $minion->worker->register;
+ my $id = $minion->enqueue('test');
+ my $id2 = $minion->enqueue('test');
+ my $id3 = $minion->enqueue('test');
+ my $id4 = $minion->enqueue('test');
+ $minion->backend->sqlite->db->query(
+ q{update minion_jobs set delayed = datetime('now', '-' || ? || ' seconds')
where id = ?},
+ $minion->stuck_after + 1, $_)
+ for $id, $id2, $id3, $id4;
+ ok $worker->dequeue(0, {id => $id4})->finish('Works!'), 'job finished';
+ my $job2 = $worker->dequeue(0, {id => $id2});
+ $minion->repair;
+ is $job2->info->{state}, 'active', 'job is still active';
+ ok $job2->finish, 'job finished';
+ my $job = $minion->job($id);
+ is $job->info->{state}, 'failed', 'job is no longer
active';
+ is $job->info->{result}, 'Job appears stuck in queue', 'right result';
+ my $job3 = $minion->job($id3);
+ is $job3->info->{state}, 'failed', 'job is no longer
active';
+ is $job3->info->{result}, 'Job appears stuck in queue', 'right result';
+ my $job4 = $minion->job($id4);
+ is $job4->info->{state}, 'finished', 'job is still finished';
+ is $job4->info->{result}, 'Works!', 'right result';
+ $worker->unregister;
+};
+
subtest 'List workers' => sub {
plan skip_all => 'Minion workers do not support fork emulation' if
HAS_PSEUDOFORK;
my $worker = $minion->worker->register;
@@ -1118,6 +1146,89 @@
$worker->unregister;
};
+subtest 'Sequences' => sub {
+ plan skip_all => 'Minion workers do not support fork emulation' if
HAS_PSEUDOFORK;
+ my $worker = $minion->worker->register;
+ my $id = $minion->enqueue('test' => [] => {sequence =>
'host:localhost'});
+ is $minion->job($id)->info->{previous}, undef, 'new sequence';
+ is $minion->job($id)->info->{next}, undef, 'new sequence';
+ my $id2 = $minion->enqueue('test' => [] => {sequence => 'host:localhost'});
+ is $minion->job($id2)->info->{previous}, $id, 'sequence in progress';
+ is $minion->job($id)->info->{next}, $id2, 'sequence in progress';
+ my $id3 = $minion->enqueue('test' => [] => {sequence => 'host:localhost',
priority => 5});
+ is $minion->job($id3)->info->{previous}, $id2, 'sequence in progress';
+ is $minion->job($id)->info->{next}, $id2, 'sequence in progress';
+ my $job = $worker->dequeue(0);
+ is $job->id, $id, 'right id';
+ is $job->info->{sequence}, 'host:localhost', 'right sequence';
+ is $job->info->{priority}, 0, 'right priority';
+ is_deeply $job->info->{children}, [$id2], 'right children';
+ is_deeply $job->info->{parents}, [], 'no parents';
+ ok $job->finish, 'job finished';
+ my $job2 = $worker->dequeue(0);
+ is $job2->id, $id2, 'right id';
+ is $job2->info->{sequence}, 'host:localhost', 'right sequence';
+ is $job2->info->{previous}, $id, 'sequence in progress';
+ is $job2->info->{next}, $id3, 'sequence in progress';
+ is $job2->info->{priority}, 0, 'right priority';
+ is_deeply $job2->info->{children}, [$id3], 'right children';
+ is_deeply $job2->info->{parents}, [$id], 'right parents';
+ ok $job2->finish, 'job finished';
+ my $job3 = $worker->dequeue(0);
+ is $job3->id, $id3, 'right id';
+ is $job3->info->{sequence}, 'host:localhost', 'right sequence';
+ is $job3->info->{previous}, $id2, 'sequence in progress';
+ is $job3->info->{next}, undef, 'sequence is ending for now';
+ is $job3->info->{priority}, 5, 'right priority';
+ is_deeply $job3->info->{children}, [], 'no children';
+ is_deeply $job3->info->{parents}, [$id2], 'right parents';
+ ok $job3->finish, 'job finished';
+
+ my $id4 = $minion->enqueue('test' => [] => {sequence => 'host:localhost'});
+ is_deeply $job3->info->{children}, [$id4], 'right children';
+ my $job4 = $worker->dequeue(0);
+ is $job4->id, $id4, 'right id';
+ is $job4->info->{sequence}, 'host:localhost', 'right sequence';
+ is_deeply $job4->info->{children}, [], 'no children';
+ is_deeply $job4->info->{parents}, [$id3], 'right parents';
+ ok $job4->finish, 'job finished';
+
+ my $id5 = $minion->enqueue('test' => [] => {sequence => 'host:localhost',
parents => [$id, $id2]});
+ my $job5 = $worker->dequeue(0);
+ is $job5->id, $id5, 'right id';
+ is $job5->info->{sequence}, 'host:localhost', 'right sequence';
+ is_deeply $job5->info->{children}, [], 'no children';
+ is_deeply $job5->info->{parents}, [$id4, $id, $id2], 'right parents';
+ ok $job5->finish, 'job finished';
+ ok $minion->job($id5)->remove, 'job removed';
+
+ my $id6 = $minion->enqueue('test' => [] => {sequence => 'host:localhost'});
+ my $job6 = $worker->dequeue(0);
+ is $job6->id, $id6, 'right id';
+ is $job6->info->{sequence}, 'host:localhost', 'right sequence';
+ is $job6->info->{previous}, undef, 'sequence restarted';
+ is $job6->info->{next}, undef, 'sequence restarted';
+ is $job4->info->{next}, $id5, 'sequence restarted';
+ is_deeply $job6->info->{children}, [], 'no children';
+ is_deeply $job6->info->{parents}, [], 'no parents';
+ ok $job6->finish, 'job finished';
+
+ $id = $minion->enqueue('test' => [] => {sequence =>
'host:mojolicious.org'});
+ $job = $worker->dequeue(0);
+ is $job->id, $id, 'right id';
+ is $job->info->{sequence}, 'host:mojolicious.org', 'right sequence';
+ is_deeply $job->info->{children}, [], 'no children';
+ is_deeply $job->info->{parents}, [], 'no parents';
+ ok $job->finish, 'job finished';
+
+ is $minion->jobs({sequences => ['host:mojolicious.org']})->total, 1, 'one
job';
+ is $minion->jobs({sequences => ['host:mojolicious.org']})->next->{id}, $id,
'same id';
+ is $minion->jobs({sequences => ['host:metacpan.org']})->total, 0, 'no jobs';
+ is $minion->jobs({sequences => ['host:localhost']})->total, 5, 'five
jobs';
+ is $minion->jobs({sequences => ['host:localhost',
'host:mojolicious.org']})->total, 6, 'six jobs';
+ $worker->unregister;
+};
+
subtest 'Foreground' => sub {
plan skip_all => 'Minion workers do not support fork emulation' if
HAS_PSEUDOFORK;
my $id = $minion->enqueue(test => [] => {attempts => 2});