mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 13:52:50 +08:00
DEV: spec hanging in CI (#22679)
Thread wakeup was failing to properly wake up thread under certain circumstances Amend it so we use a tight loop instead.
This commit is contained in:
parent
3be9e6c97e
commit
9ef2a2ac9b
|
@ -25,6 +25,14 @@ RSpec.describe ::Jobs::Base do
|
|||
class ConcurrentJob < ::Jobs::Base
|
||||
cluster_concurrency 1
|
||||
|
||||
def self.stop!
|
||||
@stop = true
|
||||
end
|
||||
|
||||
def self.stop
|
||||
@stop
|
||||
end
|
||||
|
||||
def self.running?
|
||||
@running
|
||||
end
|
||||
|
@ -35,7 +43,7 @@ RSpec.describe ::Jobs::Base do
|
|||
|
||||
def execute(args)
|
||||
self.class.running = true
|
||||
sleep 20
|
||||
sleep 0.0001 while !self.class.stop
|
||||
ensure
|
||||
self.class.running = false
|
||||
end
|
||||
|
@ -58,7 +66,8 @@ RSpec.describe ::Jobs::Base do
|
|||
|
||||
expect(Sidekiq::Queues["default"][0]["args"][0]).to eq("test" => 100)
|
||||
|
||||
thread.wakeup
|
||||
ConcurrentJob.stop!
|
||||
|
||||
thread.join
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user