Skip to content

Commit

Permalink
Prevent jobs from being enqueued in the past.
Browse files Browse the repository at this point in the history
It's relatively easy for this to happen by accident (e.g. time drift on
a rogue server), and it throws a spanner in the works if you're
monitoring for oldest job in the queue.
  • Loading branch information
xaviershay authored and dtcristo committed Mar 4, 2024
1 parent 82eb3b8 commit 94b8292
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/que/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Job
(
coalesce($1, 'default')::text,
coalesce($2, 100)::smallint,
coalesce($3, now())::timestamptz,
greatest($3, now())::timestamptz,
$4::text,
coalesce($5, '[]')::jsonb,
coalesce($6, '{}')::jsonb,
Expand All @@ -34,7 +34,7 @@ class Job
SELECT
coalesce(queue, 'default')::text,
coalesce(priority, 100)::smallint,
coalesce(run_at, now())::timestamptz,
greatest(run_at, now())::timestamptz,
job_class::text,
coalesce(args, '[]')::jsonb,
coalesce(kwargs, '{}')::jsonb,
Expand Down

0 comments on commit 94b8292

Please sign in to comment.