Open augensalat opened 2 years ago
I kind of share your concern here - but what behavior would you expect if the app starts in production, but Minion has incorrect DB parameters and will never connect to DB? It might be harder / too late to diagnose comparing to failure to start service. So, if your app is designed to work even if Minion is not able to connect - then you can just tolerate failure to load plugin at startup as well. Otherwise it is better if the failure happens sooner than later.
I'm testing a different strategy in minion.js, lets see how that works out.
Problem description
When
Minion::Backend::Pg
is instantiated insideMojolicious::startup
(typically withMojolicious::Plugin::Minion
) it connects to the PostgreSQL server to determine the server version. This can cause trouble with application commands in isolated environments, i.e. in a CI/CD workflow where Minion and its database is not available and not needed.The respective code is https://github.com/mojolicious/minion/blob/f4bc5b2e98aa619b88cd1c6188649f281be1c49e/lib/Minion/Backend/Pg.pm#L130-L132
Currrently I'm not able to find a reasonable workaround in my application code to avoid this immediate database connection attempt, see https://github.com/mojolicious/mojo/discussions/1886 .
Steps to reproduce the behavior
A Mojolicious application using Minion (with
Mojolicious::Plugin::Minion
) fails at program start when the database is not accessible.Basic application:
my_app version
fails if the database is not accessible.Expected behavior
my_app version
as any other command that is not related to Minion should work without the need to access the Minion Postgres database.At least an option should exist to disable the check for the server version in the program startup.
Actual behavior