Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion migrations/20250904065521_job_setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ BEGIN
END IF;

IF TG_OP = 'UPDATE' THEN
IF NEW.execute_at IS DISTINCT FROM OLD.execute_at THEN
-- Only wake pollers when a row is (or becomes) eligible in the
-- pending set. Transitions out of 'pending' (a poller taking the job
-- sets execute_at = NULL, completion, etc.) must not notify: the
-- poller's own UPDATE would wake every poller including itself for
-- no reason, multiplying poll load with throughput.
IF NEW.state = 'pending'
AND NEW.execute_at IS DISTINCT FROM OLD.execute_at THEN
PERFORM pg_notify('job_events',
json_build_object('type', 'execution_ready', 'job_type', NEW.job_type)::text);
END IF;
Expand Down
Loading