Skip to content

Instantly share code, notes, and snippets.

@ejoubaud
Last active April 16, 2019 08:50
Show Gist options
  • Save ejoubaud/a443519b26ae18f844142451d400ba34 to your computer and use it in GitHub Desktop.
Save ejoubaud/a443519b26ae18f844142451d400ba34 to your computer and use it in GitHub Desktop.
DJ (delayed_jobs) queue check
select
if(locate('PerformableMethod', s1) > 0,
if(locate('method_name', s3) > 0,
s3,
s2
),
s1
) s,
sum(run_at <= now()) as total_waiting, -- date_add(now(), interval 8 hour))
min(priority),
count(1) as total,
sum(run_at > now()) as total_scheduled_for_later, -- date_add(now(), interval 8 hour))
max(priority),
min(run_at),
queue
from
(
select
substring_index(handler, "\n", 1) s1,
substring_index(handler, "\n", 2) s2,
substring_index(handler, "\n", 3) s3,
handler,
run_at,
priority,
queue
from delayed_jobs
) d
group by s
order by total_waiting desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment