mirror of https://github.com/rails/rails
fix Que integration tests for Active Job
Replace Que.* settings that were removed in Que 1.0 with options passed to Que::Locker. The Locker class creates its own thread for managing work distribution, so the Thread created in the QueJobsManager was also removed.
This commit is contained in:
parent
efae65d005
commit
f83f5c81af
|
@ -403,7 +403,7 @@ GEM
|
|||
public_suffix (4.0.6)
|
||||
puma (5.5.2)
|
||||
nio4r (~> 2.0)
|
||||
que (0.14.3)
|
||||
que (1.0.0)
|
||||
raabro (1.4.0)
|
||||
racc (1.6.0)
|
||||
rack (2.2.3)
|
||||
|
|
|
@ -4,8 +4,6 @@ module QueJobsManager
|
|||
def setup
|
||||
require "sequel"
|
||||
ActiveJob::Base.queue_adapter = :que
|
||||
Que.mode = :off
|
||||
Que.worker_count = 1
|
||||
end
|
||||
|
||||
def clear_jobs
|
||||
|
@ -21,14 +19,13 @@ module QueJobsManager
|
|||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -X -c 'drop database if exists "#{db}"' -U #{user} -t template1}
|
||||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -X -c 'create database "#{db}"' -U #{user} -t template1}
|
||||
Que.connection = Sequel.connect(que_url)
|
||||
Que.migrate!
|
||||
Que.migrate!(version: Que::Migrations::CURRENT_VERSION)
|
||||
|
||||
@thread = Thread.new do
|
||||
loop do
|
||||
Que::Job.work("integration_tests")
|
||||
sleep 0.5
|
||||
end
|
||||
end
|
||||
@locker = Que::Locker.new(
|
||||
queues: ["integration_tests"],
|
||||
poll_interval: 0.5,
|
||||
worker_priorities: [nil]
|
||||
)
|
||||
|
||||
rescue Sequel::DatabaseConnectionError
|
||||
puts "Cannot run integration tests for que. To be able to run integration tests for que you need to install and start postgresql.\n"
|
||||
|
@ -37,6 +34,6 @@ module QueJobsManager
|
|||
end
|
||||
|
||||
def stop_workers
|
||||
@thread.kill
|
||||
@locker.stop!
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue