Change the lines where Minion waits for a minion.job message to
use Mojo::Pg::PubSub
Motivation
I've been seeing an issue, which seems to be a race condition. In
my app, when I'm using Minion::Notifier, for some reason, I get
a crash on the first time that a job gets dequed. This happens
unless There's a job ready when I start Minion.
Here's the error message
Mojo::Reactor::Poll: I/O watcher failed: Can't use an undefined value as an ARRAY reference at /home/veesh/.plenv/versions/5.32.0/lib/perl5/site_perl/5.32.0/Mojo/Pg/PubSub.pm line 21.
at /home/veesh/.plenv/versions/5.32.0/lib/perl5/site_perl/5.32.0/Minion/Command/minion/worker.pm line 26.
What seems to be the cause is that once Mojo::Pg::PubSub's db
method has been called, it sets up a listener which will respond
to any notification which comes down. The death here comes from
the fact that it tries to respond to the 'minion.job' channel, and
dies b/c it doesn't have any callbacks for it.
Summary
Change the lines where Minion waits for a
minion.job
message to use Mojo::Pg::PubSubMotivation
I've been seeing an issue, which seems to be a race condition. In my app, when I'm using
Minion::Notifier
, for some reason, I get a crash on the first time that a job gets dequed. This happens unless There's a job ready when I start Minion.Here's the error message
What seems to be the cause is that once Mojo::Pg::PubSub's
db
method has been called, it sets up a listener which will respond to any notification which comes down. The death here comes from the fact that it tries to respond to the 'minion.job' channel, and dies b/c it doesn't have any callbacks for it.