-
Hi @ALL! I'm currently trying to get my application updated to the last mojo and minion updates. Sad to say that I'm currently stuck at Mojolicious version 8.26 and Minion version 9.13. However, directly updating the core packages to the latest versions (Mojolicious 9.22 and Minion 10.22) worked like a charm despite one thing, which I'm unable to solve right now. The application in question can be started in two modes: The issue occurs in mode b. In the callback for the emitted To clarify and nail down the problem, I wrote a small POC script. use Mojolicious::Lite -signatures;
use Mojolicious;
use Mojo::IOLoop;
use Minion;
use Mojo::Log;
my $log = Mojo::Log->new;
my $mojoVersion = Mojolicious->VERSION;
my $minionVersion = Minion->VERSION;
my $uri = 'postgresql://';
$uri .= $ENV{POSTGRES_USER} if $ENV{POSTGRES_USER};
$uri .= ':' . $ENV{POSTGRES_PASSWORD} if $ENV{POSTGRES_PASSWORD};
$uri .= '@' . $ENV{POSTGRES_HOST} if $ENV{POSTGRES_HOST};
$uri .= '/' . $ENV{POSTGRES_DB} if $ENV{POSTGRES_DB};
$log->info("Mojolicous: $mojoVersion - Minion: $minionVersion");
Mojo::IOLoop->recurring(5 => sub ($ioloop) {
$log->info('[Mojo] Outer IOLoop recurring all 5 sec.');
});
app->plugin( Minion => { Pg => $uri });
app->minion->on(worker => sub ($minion, $worker) {
$log->info('[Minion] worker started.');
my $id = Mojo::IOLoop->recurring(1 => sub ($ioloop) {
$log->info('[Minion] Inner IOLoop recurring every sec.');
});
});
app->start; It is executed a) as daemon (service mojo) and b) as minion worker (service minion) using docker-compose
Running this script on the old version it works as expected and the output is as follows: Running against the new versions, it shows that Mojo::IOLoop is not executed at all in a minion worker process. Both container (old [1] and upgraded [2]) are running the same OS and perl version. Currently, I've no clue what's going wrong. Reading through the Mojolicious and Minion release notes (changes.md) didn't help me either. Hope someone can help :) Thank's in advance for your support, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Okay, digged into the Minion release notes once again and found this change added in tag 10.14 Seem's that this will reset all IOLoops when the worker starts running? Thus, also my registered IOLoop placed in the callback? |
Beta Was this translation helpful? Give feedback.
-
This is no good practice at all. E.g.: (my HWG SMS Gateway solution) The minion reference is worth reading though... |
Beta Was this translation helpful? Give feedback.
-
Since mojolicious/minion@5cb6241 Mojo::IOLoop is reset in Minion::Worker->run to prevent shared timers between Mojolicious and Minion, which breaks my previous implementations (seems it only worked due to a "bug" 😄 :/) As mentioned by @fskale, app/worker and poller should be separated. |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
Since mojolicious/minion@5cb6241 Mojo::IOLoop is reset in Minion::Worker->run to prevent shared timers between Mojolicious and Minion, which breaks my previous implementations (seems it only worked due to a "bug" 😄 :/)
As mentioned by @fskale, app/worker and poller should be separated.