11 lines
416 B
SQL
11 lines
416 B
SQL
-- Whether the queue is "maxed": it has a global concurrency limit and the
|
|
-- number of active jobs has reached it (mirrors isQueueMaxed). Returns false
|
|
-- when no concurrency limit is configured.
|
|
-- Params: $1 queue.
|
|
SELECT COALESCE(
|
|
(SELECT count(*) FROM job WHERE queue = $1 AND state = 'active')
|
|
>= (SELECT value::integer FROM meta
|
|
WHERE queue = $1 AND field = 'concurrency'),
|
|
false
|
|
) AS maxed;
|