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 a4eb473 commit 14de59d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions features/fixtures/que/app/enqueue-job.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
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
puts "~*~ que_jobs exists? ~*~ ", $connection.exec(query)[0]["que_jobs_exists"]

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 14de59d

Please sign in to comment.