Hello community,

here is the log from the commit of package perl-Minion for openSUSE:Factory 
checked in at 2017-11-27 22:15:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Minion (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Minion.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Minion"

Mon Nov 27 22:15:55 2017 rev:35 rq:545260 version:8.03

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Minion/perl-Minion.changes  2017-11-23 
09:43:40.770122628 +0100
+++ /work/SRC/openSUSE:Factory/.perl-Minion.new/perl-Minion.changes     
2017-11-27 22:15:56.836000575 +0100
@@ -1,0 +2,11 @@
+Thu Nov 23 06:38:23 UTC 2017 - [email protected]
+
+- updated to 8.03
+   see /usr/share/doc/packages/perl-Minion/Changes
+
+  8.03  2017-11-21
+    - Removed -f option from worker command.
+    - Added broadcast method to Minion.
+    - Added run method to Minion::Worker.
+
+-------------------------------------------------------------------

Old:
----
  Minion-8.02.tar.gz

New:
----
  Minion-8.03.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Minion.spec ++++++
--- /var/tmp/diff_new_pack.4316F3/_old  2017-11-27 22:15:57.875962825 +0100
+++ /var/tmp/diff_new_pack.4316F3/_new  2017-11-27 22:15:57.883962534 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Minion
-Version:        8.02
+Version:        8.03
 Release:        0
 %define cpan_name Minion
 Summary:        Job queue
@@ -35,12 +35,13 @@
 %{perl_requires}
 
 %description
-Minion is a job queue for the at http://mojolicious.org real-time web
-framework, with support for multiple named queues, priorities, delayed
-jobs, job dependencies, job progress, job results, retries with backoff,
-rate limiting, unique jobs, statistics, distributed workers, parallel
-processing, autoscaling, remote control, admin ui, resource leak protection
-and multiple backends (such as at http://www.postgresql.org).
+Minion is a high performance job queue for the Perl programming language,
+with support for multiple named queues, priorities, delayed jobs, job
+dependencies, job progress, job results, retries with backoff, rate
+limiting, unique jobs, statistics, distributed workers, parallel
+processing, autoscaling, remote control, at http://mojolicious.org admin
+ui, resource leak protection and multiple backends (such as at
+http://www.postgresql.org).
 
 Job queues allow you to process time and/or computationally intensive tasks
 in background processes, outside of the request/response lifecycle. Among

++++++ Minion-8.02.tar.gz -> Minion-8.03.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/Changes new/Minion-8.03/Changes
--- old/Minion-8.02/Changes     2017-11-19 16:52:12.000000000 +0100
+++ new/Minion-8.03/Changes     2017-11-21 23:35:38.000000000 +0100
@@ -1,4 +1,9 @@
 
+8.03  2017-11-21
+  - Removed -f option from worker command.
+  - Added broadcast method to Minion.
+  - Added run method to Minion::Worker.
+
 8.02  2017-11-19
   - Improved admin ui with alerts for job management.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/MANIFEST new/Minion-8.03/MANIFEST
--- old/Minion-8.02/MANIFEST    2017-11-19 17:36:58.000000000 +0100
+++ new/Minion-8.03/MANIFEST    2017-11-22 12:25:03.000000000 +0100
@@ -53,6 +53,7 @@
 t/pg.t
 t/pg_admin.t
 t/pg_lite_app.t
+t/pg_worker.t
 t/pod.t
 t/pod_coverage.t
 META.yml                                 Module YAML meta-data (added by 
MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/META.json new/Minion-8.03/META.json
--- old/Minion-8.02/META.json   2017-11-19 17:36:58.000000000 +0100
+++ new/Minion-8.03/META.json   2017-11-22 12:25:03.000000000 +0100
@@ -54,6 +54,6 @@
       },
       "x_IRC" : "irc://irc.perl.org/#mojo"
    },
-   "version" : "8.02",
-   "x_serialization_backend" : "JSON::PP version 2.94"
+   "version" : "8.03",
+   "x_serialization_backend" : "JSON::PP version 2.97000"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/META.yml new/Minion-8.03/META.yml
--- old/Minion-8.02/META.yml    2017-11-19 17:36:58.000000000 +0100
+++ new/Minion-8.03/META.yml    2017-11-22 12:25:02.000000000 +0100
@@ -27,5 +27,5 @@
   homepage: http://mojolicious.org
   license: http://www.opensource.org/licenses/artistic-license-2.0
   repository: https://github.com/kraih/minion.git
-version: '8.02'
+version: '8.03'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/README.md new/Minion-8.03/README.md
--- old/Minion-8.02/README.md   2017-11-16 23:33:12.000000000 +0100
+++ new/Minion-8.03/README.md   2017-11-21 23:55:59.000000000 +0100
@@ -3,12 +3,13 @@
 
 
![Screenshot](https://raw.github.com/kraih/minion/master/examples/admin.png?raw=true)
 
-  A job queue for the [Mojolicious](http://mojolicious.org) real-time web
-  framework, with support for multiple named queues, priorities, delayed jobs,
-  job dependencies, job progress, job results, retries with backoff, rate
-  limiting, unique jobs, statistics, distributed workers, parallel processing,
-  autoscaling, remote control, admin ui, resource leak protection and multiple
-  backends (such as [PostgreSQL](http://www.postgresql.org)).
+  A high performance job queue for the Perl programming language, with support
+  for multiple named queues, priorities, delayed jobs, job dependencies, job
+  progress, job results, retries with backoff, rate limiting, unique jobs,
+  statistics, distributed workers, parallel processing, autoscaling, remote
+  control, [Mojolicious](http://mojolicious.org) admin ui, resource leak
+  protection and multiple backends (such as
+  [PostgreSQL](http://www.postgresql.org)).
 
   Job queues allow you to process time and/or computationally intensive tasks 
in
   background processes, outside of the request/response lifecycle. Among those
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/lib/Minion/Command/minion/worker.pm 
new/Minion-8.03/lib/Minion/Command/minion/worker.pm
--- old/Minion-8.02/lib/Minion/Command/minion/worker.pm 2017-11-10 
01:02:16.000000000 +0100
+++ new/Minion-8.03/lib/Minion/Command/minion/worker.pm 2017-11-22 
12:09:41.000000000 +0100
@@ -1,7 +1,7 @@
 package Minion::Command::minion::worker;
 use Mojo::Base 'Mojolicious::Command';
 
-use Mojo::Util qw(getopt steady_time);
+use Mojo::Util 'getopt';
 
 has description => 'Start Minion worker';
 has usage => sub { shift->extract_usage };
@@ -9,80 +9,31 @@
 sub run {
   my ($self, @args) = @_;
 
-  my $app    = $self->app;
-  my $worker = $self->{worker} = $app->minion->worker;
+  my $worker = $self->app->minion->worker;
   my $status = $worker->status;
-  $status->{performed} //= 0;
-
   getopt \@args,
-    'C|command-interval=i'   => \($status->{command_interval}   //= 10),
-    'f|fast-start'           => \my $fast,
-    'I|heartbeat-interval=i' => \($status->{heartbeat_interval} //= 300),
-    'j|jobs=i'               => \($status->{jobs}               //= 4),
-    'q|queue=s'              => ($status->{queues}              //= []),
-    'R|repair-interval=i'    => \($status->{repair_interval}    //= 21600);
-  @{$status->{queues}} = ('default') unless @{$status->{queues}};
-  $status->{repair_interval} -= int rand $status->{repair_interval} / 2;
-  $self->{last_repair} = $fast ? steady_time : 0;
-
-  local $SIG{CHLD} = sub { };
-  local $SIG{INT} = local $SIG{TERM} = sub { $self->{finished}++ };
-  local $SIG{QUIT}
-    = sub { ++$self->{finished} and kill 'KILL', keys %{$self->{jobs}} };
-
-  # Remote control commands need to validate arguments carefully
-  $worker->add_command(
-    jobs => sub { $status->{jobs} = $_[1] if ($_[1] // '') =~ /^\d+$/ });
-  $worker->add_command(
-    stop => sub { $self->{jobs}{$_[1]}->stop if $self->{jobs}{$_[1] // ''} });
+    'C|command-interval=i'   => \$status->{command_interval},
+    'I|heartbeat-interval=i' => \$status->{heartbeat_interval},
+    'j|jobs=i'               => \$status->{jobs},
+    'q|queue=s'              => \my @queues,
+    'R|repair-interval=i'    => \$status->{repair_interval};
+  $status->{queues} = \@queues if @queues;
 
-  # Log fatal errors
-  my $log = $app->log;
+  my $log = $self->app->log;
   $log->info("Worker $$ started");
-  eval { $self->_work until $self->{finished} && !keys %{$self->{jobs}}; 1 }
-    or $log->fatal("Worker error: $@");
-  $worker->unregister;
+  $worker->on(
+    dequeue => sub {
+      pop->once(spawn => sub { _spawn($log, @_) });
+    }
+  );
+  $worker->run;
   $log->info("Worker $$ stopped");
 }
 
-sub _work {
-  my $self = shift;
-
-  # Send heartbeats in regular intervals
-  my $worker = $self->{worker};
-  my $status = $worker->status;
-  $self->{last_heartbeat} ||= -$status->{heartbeat_interval};
-  $worker->register and $self->{last_heartbeat} = steady_time
-    if ($self->{last_heartbeat} + $status->{heartbeat_interval}) < steady_time;
-
-  # Process worker remote control commands in regular intervals
-  $self->{last_command} ||= 0;
-  $worker->process_commands and $self->{last_command} = steady_time
-    if ($self->{last_command} + $status->{command_interval}) < steady_time;
-
-  # Repair in regular intervals (randomize to avoid congestion)
-  my $app = $self->app;
-  my $log = $app->log;
-  if (($self->{last_repair} + $status->{repair_interval}) < steady_time) {
-    $log->debug('Checking worker registry and job queue');
-    $app->minion->repair;
-    $self->{last_repair} = steady_time;
-  }
-
-  # Check if jobs are finished
-  my $jobs = $self->{jobs} ||= {};
-  $jobs->{$_}->is_finished and ++$status->{performed} and delete $jobs->{$_}
-    for keys %$jobs;
-
-  # Wait if job limit has been reached or worker is stopping
-  if (($status->{jobs} <= keys %$jobs) || $self->{finished}) { sleep 1 }
-
-  # Try to get more jobs
-  elsif (my $job = $worker->dequeue(5 => {queues => $status->{queues}})) {
-    $jobs->{my $id = $job->id} = $job->start;
-    my ($pid, $task) = ($job->pid, $job->task);
-    $log->debug(qq{Process $pid is performing job "$id" with task "$task"});
-  }
+sub _spawn {
+  my ($log, $job, $pid) = @_;
+  my ($id, $task) = ($job->id, $job->task);
+  $log->debug(qq{Process $pid is performing job "$id" with task "$task"});
 }
 
 1;
@@ -105,8 +56,6 @@
   Options:
     -C, --command-interval <seconds>     Worker remote control command 
interval,
                                          defaults to 10
-    -f, --fast-start                     Start processing jobs as fast as
-                                         possible and skip repairing on startup
     -h, --help                           Show this summary of available options
         --home <path>                    Path to home directory of your
                                          application, defaults to the value of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/lib/Minion/Worker.pm 
new/Minion-8.03/lib/Minion/Worker.pm
--- old/Minion-8.02/lib/Minion/Worker.pm        2017-11-14 17:02:12.000000000 
+0100
+++ new/Minion-8.03/lib/Minion/Worker.pm        2017-11-22 12:02:02.000000000 
+0100
@@ -1,6 +1,9 @@
 package Minion::Worker;
 use Mojo::Base 'Mojo::EventEmitter';
 
+use Carp 'croak';
+use Mojo::Util 'steady_time';
+
 has [qw(commands status)] => sub { {} };
 has [qw(id minion)];
 
@@ -47,12 +50,78 @@
   return $self->id($self->minion->backend->register_worker($self->id, 
$status));
 }
 
+sub run {
+  my $self = shift;
+
+  my $status = $self->status;
+  $status->{command_interval}   //= 10;
+  $status->{heartbeat_interval} //= 300;
+  $status->{jobs}               //= 4;
+  $status->{queues} ||= ['default'];
+  $status->{performed}       //= 0;
+  $status->{repair_interval} //= 21600;
+  $status->{repair_interval} -= int rand $status->{repair_interval} / 2;
+
+  local $SIG{CHLD} = sub { };
+  local $SIG{INT} = local $SIG{TERM} = sub { $self->{finished}++ };
+  local $SIG{QUIT}
+    = sub { ++$self->{finished} and kill 'KILL', keys %{$self->{jobs}} };
+
+  # Remote control commands need to validate arguments carefully
+  my $commands = $self->commands;
+  local $commands->{jobs}
+    = sub { $status->{jobs} = $_[1] if ($_[1] // '') =~ /^\d+$/ };
+  local $commands->{stop}
+    = sub { $self->{jobs}{$_[1]}->stop if $self->{jobs}{$_[1] // ''} };
+
+  eval { $self->_work until $self->{finished} && !keys %{$self->{jobs}} };
+  my $err = $@;
+  $self->unregister;
+  croak $err if $err;
+}
+
 sub unregister {
   my $self = shift;
   $self->minion->backend->unregister_worker(delete $self->{id});
   return $self;
 }
 
+sub _work {
+  my $self = shift;
+
+  # Send heartbeats in regular intervals
+  my $status = $self->status;
+  $self->{last_heartbeat} ||= -$status->{heartbeat_interval};
+  $self->register and $self->{last_heartbeat} = steady_time
+    if ($self->{last_heartbeat} + $status->{heartbeat_interval}) < steady_time;
+
+  # Process worker remote control commands in regular intervals
+  $self->{last_command} ||= 0;
+  $self->process_commands and $self->{last_command} = steady_time
+    if ($self->{last_command} + $status->{command_interval}) < steady_time;
+
+  # Repair in regular intervals (randomize to avoid congestion)
+  $self->{last_repair} ||= 0;
+  if (($self->{last_repair} + $status->{repair_interval}) < steady_time) {
+    $self->minion->repair;
+    $self->{last_repair} = steady_time;
+  }
+
+  # Check if jobs are finished
+  my $jobs = $self->{jobs} ||= {};
+  $jobs->{$_}->is_finished and ++$status->{performed} and delete $jobs->{$_}
+    for keys %$jobs;
+
+  # Wait if job limit has been reached or worker is stopping
+  if (($status->{jobs} <= keys %$jobs) || $self->{finished}) { sleep 1 }
+
+  # Try to get more jobs
+  elsif (my $job = $self->dequeue(5 => {queues => $status->{queues}})) {
+    $jobs->{my $id = $job->id} = $job->start;
+    my ($pid, $task) = ($job->pid, $job->task);
+  }
+}
+
 1;
 
 =encoding utf8
@@ -71,6 +140,19 @@
 
 L<Minion::Worker> performs jobs for L<Minion>.
 
+=head1 SIGNALS
+
+The L<Minion::Worker> process can be controlled at runtime with the following
+signals.
+
+=head2 INT, TERM
+
+Stop gracefully after finishing the current jobs.
+
+=head2 QUIT
+
+Stop immediately without finishing the current jobs.
+
 =head1 EVENTS
 
 L<Minion::Worker> inherits all events from L<Mojo::EventEmitter> and can emit
@@ -121,7 +203,8 @@
   my $status = $worker->status;
   $worker    = $worker->status({queues => ['default', 'important']);
 
-Status information to share every time L</"register"> is called.
+Status information to configure workers started with L</"run"> and to share
+every time L</"register"> is called.
 
 =head1 METHODS
 
@@ -229,6 +312,75 @@
 
 Register worker or send heartbeat to show that this worker is still alive.
 
+=head2 run
+
+  $worker->run;
+
+Run worker and wait for L</"SIGNALS">.
+
+These L</"status"> options are currently available:
+
+=over 2
+
+=item command_interval
+
+  command_interval => 20
+
+Worker remote control command interval, defaults to C<10>.
+
+=item heartbeat_interval
+
+  heartbeat_interval => 60
+
+Heartbeat interval, defaults to C<300>.
+
+=item jobs
+
+  jobs => 12
+
+Maximum number of jobs to perform parallel in forked worker processes, defaults
+to C<4>.
+
+=item queues
+
+  queues => ['test']
+
+One or more queues to get jobs from, defaults to C<default>.
+
+=item repair_interval
+
+  repair_interval => 3600
+
+Repair interval, up to half of this value can be subtracted randomly to make
+sure not all workers repair at the same time, defaults to C<21600> (6 hours).
+
+=back
+
+These remote control L</"commands"> are currently available:
+
+=over 2
+
+=item jobs
+
+  $minion->broadcast('jobs', [10]);
+  $minion->broadcast('jobs', [10], [$worker_id]);
+
+Instruct one or more workers to change the number of jobs to perform
+concurrently. Setting this value to C<0> will effectively pause the worker. 
That
+means all current jobs will be finished, but no new ones accepted, until the
+number is increased again.
+
+=item stop
+
+  $minion->broadcast('stop', [10025]);
+  $minion->broadcast('stop', [10025], [$worker_id]);
+
+Instruct one or more workers to stop a job that is currently being performed
+immediately. This command will be ignored by workers that do not have a job
+matching the id. That means it is safe to broadcast this command to all 
workers.
+
+=back
+
 =head2 unregister
 
   $worker = $worker->unregister;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/lib/Minion.pm 
new/Minion-8.03/lib/Minion.pm
--- old/Minion-8.02/lib/Minion.pm       2017-11-18 17:12:43.000000000 +0100
+++ new/Minion-8.03/lib/Minion.pm       2017-11-22 12:00:10.000000000 +0100
@@ -17,10 +17,12 @@
 has remove_after  => 172800;
 has tasks         => sub { {} };
 
-our $VERSION = '8.02';
+our $VERSION = '8.03';
 
 sub add_task { ($_[0]->tasks->{$_[1]} = $_[2]) and return $_[0] }
 
+sub broadcast { shift->backend->broadcast(@_) }
+
 sub enqueue {
   my $self = shift;
   my $id   = $self->backend->enqueue(@_);
@@ -154,7 +156,12 @@
   $minion->enqueue(something_slow => ['foo', 'bar']);
   $minion->perform_jobs;
 
-  # Build more sophisticated workers
+  # Start a worker to perform up to 12 jobs concurrently
+  my $worker = $minion->worker;
+  $worker->status->{jobs} = 12;
+  $worker->run;
+
+  # Build custom workers
   my $worker = $minion->repair->worker;
   while (int rand 2) {
     if (my $job = $worker->register->dequeue(5)) { $job->perform }
@@ -173,12 +180,13 @@
 
 =end html
 
-L<Minion> is a job queue for the L<Mojolicious|http://mojolicious.org> 
real-time
-web framework, with support for multiple named queues, priorities, delayed 
jobs,
-job dependencies, job progress, job results, retries with backoff, rate
-limiting, unique jobs, statistics, distributed workers, parallel processing,
-autoscaling, remote control, admin ui, resource leak protection and multiple
-backends (such as L<PostgreSQL|http://www.postgresql.org>).
+L<Minion> is a high performance job queue for the Perl programming language,
+with support for multiple named queues, priorities, delayed jobs, job
+dependencies, job progress, job results, retries with backoff, rate limiting,
+unique jobs, statistics, distributed workers, parallel processing, autoscaling,
+remote control, L<Mojolicious|http://mojolicious.org> admin ui, resource leak
+protection and multiple backends (such as
+L<PostgreSQL|http://www.postgresql.org>).
 
 Job queues allow you to process time and/or computationally intensive tasks in
 background processes, outside of the request/response lifecycle. Among those
@@ -390,6 +398,14 @@
   my $id = $minion->enqueue(add => [1, 1]);
   my $result = $minion->job($id)->info->{result};
 
+=head2 broadcast
+
+  my $bool = $minion->broadcast('some_command');
+  my $bool = $minion->broadcast('some_command', [@args]);
+  my $bool = $minion->broadcast('some_command', [@args], [$id1, $id2, $id3]);
+
+Broadcast remote control command to one or more workers.
+
 =head2 enqueue
 
   my $id = $minion->enqueue('foo');
@@ -672,6 +688,15 @@
 
 Build L<Minion::Worker> object.
 
+  # Start a worker
+  $minion->worker->run;
+
+  # Perform one job manually
+  my $worker = $minion->repair->worker->register;
+  my $job    = $worker->dequeue(5);
+  $job->perform;
+  $worker->unregister;
+
 =head1 REFERENCE
 
 This is the class hierarchy of the L<Minion> distribution.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/lib/Mojolicious/Plugin/Minion/Admin.pm 
new/Minion-8.03/lib/Mojolicious/Plugin/Minion/Admin.pm
--- old/Minion-8.02/lib/Mojolicious/Plugin/Minion/Admin.pm      2017-11-19 
17:18:30.000000000 +0100
+++ new/Minion-8.03/lib/Mojolicious/Plugin/Minion/Admin.pm      2017-11-19 
23:06:43.000000000 +0100
@@ -88,16 +88,15 @@
   my $minion = $c->minion;
   my $ids    = $validation->every_param('id');
   my $do     = $validation->param('do');
-  my $i      = 0;
   if ($do eq 'retry') {
-    $minion->job($_)->retry and $i++ for @$ids;
-    if   (@$ids - $i) { $c->flash(danger  => "Couldn't retry all jobs.") }
-    else              { $c->flash(success => 'All selected jobs retried.') }
+    my $fail = grep { $minion->job($_)->retry ? () : 1 } @$ids;
+    if   ($fail) { $c->flash(danger  => "Couldn't retry all jobs.") }
+    else         { $c->flash(success => 'All selected jobs retried.') }
   }
   elsif ($do eq 'remove') {
-    $minion->job($_)->remove and $i++ for @$ids;
-    if   (@$ids - $i) { $c->flash(danger  => "Couldn't remove all jobs.") }
-    else              { $c->flash(success => 'All selected jobs removed.') }
+    my $fail = grep { $minion->job($_)->remove ? () : 1 } @$ids;
+    if   ($fail) { $c->flash(danger  => "Couldn't remove all jobs.") }
+    else         { $c->flash(success => 'All selected jobs removed.') }
   }
   elsif ($do eq 'stop') {
     $minion->backend->broadcast(stop => [$_]) for @$ids;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/t/pg.t new/Minion-8.03/t/pg.t
--- old/Minion-8.02/t/pg.t      2017-11-16 19:35:25.000000000 +0100
+++ new/Minion-8.03/t/pg.t      2017-11-21 23:29:42.000000000 +0100
@@ -782,26 +782,25 @@
   for $worker, $worker2;
 $worker->add_command(test_args => sub { shift and push @commands, [@_] })
   ->register;
-ok $minion->backend->broadcast('test_id', [], [$worker->id]), 'sent command';
-ok $minion->backend->broadcast('test_id', [], [$worker->id, $worker2->id]),
+ok $minion->broadcast('test_id', [], [$worker->id]), 'sent command';
+ok $minion->broadcast('test_id', [], [$worker->id, $worker2->id]),
   'sent command';
 $worker->process_commands->register;
 $worker2->process_commands;
 is_deeply \@commands, [$worker->id, $worker->id, $worker2->id],
   'right structure';
 @commands = ();
-ok $minion->backend->broadcast('test_id'),       'sent command';
-ok $minion->backend->broadcast('test_whatever'), 'sent command';
-ok $minion->backend->broadcast('test_args', [23], []), 'sent command';
-ok $minion->backend->broadcast('test_args', [1, [2], {3 => 'three'}],
-  [$worker->id]),
+ok $minion->broadcast('test_id'),       'sent command';
+ok $minion->broadcast('test_whatever'), 'sent command';
+ok $minion->broadcast('test_args', [23], []), 'sent command';
+ok $minion->broadcast('test_args', [1, [2], {3 => 'three'}], [$worker->id]),
   'sent command';
 $_->process_commands for $worker, $worker2;
 is_deeply \@commands,
   [$worker->id, [23], [1, [2], {3 => 'three'}], $worker2->id],
   'right structure';
 $_->unregister for $worker, $worker2;
-ok !$minion->backend->broadcast('test_id', []), 'command not sent';
+ok !$minion->broadcast('test_id', []), 'command not sent';
 
 # Clean up once we are done
 $pg->db->query('drop schema minion_test cascade');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Minion-8.02/t/pg_worker.t 
new/Minion-8.03/t/pg_worker.t
--- old/Minion-8.02/t/pg_worker.t       1970-01-01 01:00:00.000000000 +0100
+++ new/Minion-8.03/t/pg_worker.t       2017-11-22 12:05:26.000000000 +0100
@@ -0,0 +1,49 @@
+use Mojo::Base -strict;
+
+BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
+
+use Test::More;
+
+plan skip_all => 'set TEST_ONLINE to enable this test' unless 
$ENV{TEST_ONLINE};
+
+use Minion;
+
+# Isolate tests
+require Mojo::Pg;
+my $pg = Mojo::Pg->new($ENV{TEST_ONLINE});
+$pg->db->query('drop schema if exists minion_worker_test cascade');
+$pg->db->query('create schema minion_worker_test');
+my $minion = Minion->new(Pg => $ENV{TEST_ONLINE});
+$minion->backend->pg->search_path(['minion_worker_test']);
+
+# Basics
+$minion->add_task(
+  test => sub {
+    my $job = shift;
+    $job->finish({just => 'works!'});
+  }
+);
+my $worker = $minion->worker;
+$worker->on(
+  dequeue => sub {
+    my ($worker, $job) = @_;
+    $job->on(reap => sub { kill 'INT', $$ });
+  }
+);
+my $id = $minion->enqueue('test');
+$worker->run;
+is_deeply $minion->job($id)->info->{result}, {just => 'works!'}, 'right 
result';
+
+# Status
+my $status = $worker->status;
+is $status->{command_interval},   10,  'right value';
+is $status->{heartbeat_interval}, 300, 'right value';
+is $status->{jobs},               4,   'right value';
+is_deeply $status->{queues}, ['default'], 'right structure';
+is $status->{performed}, 1, 'right value';
+ok $status->{repair_interval}, 'has a value';
+
+# Clean up once we are done
+$pg->db->query('drop schema minion_worker_test cascade');
+
+done_testing();


Reply via email to