mojolicious / minion

:octopus: Perl high performance job queue
https://metacpan.org/release/Minion
Artistic License 2.0
224 stars 56 forks source link

[Feature Request] ability to filter delayed jobs #112

Open xurc opened 3 years ago

xurc commented 3 years ago

It would be great to be able to exclude delayed jobs in a "jobs" method. We use metrics for monitoring and alerts in case jobs for some reason begin to accumulate in the queue and now delayed jobs have to be filtered on the perl-side, which significantly affects performance.

I understand that I can just make a SQL-query directly to the database, but this is a kludge and I would like to have an honest filter in the minions API.

Something like:

# Count waiting jobs
say $minion->jobs({waiting => 1})->total;
kraih commented 3 years ago

I would make it say $minion->jobs({delayed => true/false})->total;, but yes, that seems like a useful feature.