Skip to content

Commit

Permalink
Check que_jobs exists before queueing jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
imjoehaines committed Dec 15, 2023
1 parent c9d002c commit 0ddd889
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions features/fixtures/que/app/enqueue-job.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
require_relative "setup-que"

query = <<-SQL
SELECT EXISTS (
SELECT FROM pg_tables WHERE tablename = 'que_jobs'
) AS que_jobs_exists
SQL

Timeout::timeout(10) do
loop do
break if $connection.exec(query)[0]["que_jobs_exists"] == "t"

sleep 0.1
end
end

case ARGV[0]
when "unhandled"
UnhandledJob.enqueue
Expand Down

0 comments on commit 0ddd889

Please sign in to comment.