feat: move schedules to registered workers
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-01-18 13:18:12 +01:00
parent 1d4a72fd5f
commit 1cf9d23491
8 changed files with 140 additions and 3 deletions

View File

@@ -54,3 +54,23 @@ SET
WHERE
schedule_id = $1;
-- name: GetUnattended :many
SELECT
*
FROM
work_schedule
WHERE
worker_id NOT IN (SELECT unnest(@worker_ids::uuid[]))
AND state <> 'archived'
--AND updated_at <= now() - INTERVAL '10 minutes'
ORDER BY updated_at DESC
LIMIT @amount::integer;
-- name: UpdateSchdule :exec
UPDATE work_schedule
SET
state = 'pending'
, worker_id = $1
, updated_at = now()
WHERE
schedule_id = $2;