-
-
Save anonymous/08ce391d514740e05d8d99f53aa43ade to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$self->pg->db->query( | |
"with queues as (select distinct queue from minion_jobs), | |
states as ( | |
select unnest(array['active', 'failed', 'finished', 'inactive']) | |
as state | |
) | |
select json_object_agg(queue, ( | |
select jsonb_object_agg(state || '_jobs', ( | |
select count(*) from minion_jobs where state::text = states.state and queue = queues.queue | |
)) | |
from states | |
)) from queues" | |
)->expand->array->[0]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment