diff --git a/spec/components/scheduler/manager_spec.rb b/spec/components/scheduler/manager_spec.rb index 0dd1e3891e1..88ccb22639e 100644 --- a/spec/components/scheduler/manager_spec.rb +++ b/spec/components/scheduler/manager_spec.rb @@ -77,7 +77,9 @@ describe Scheduler::Manager do ActiveRecord::Base.connection_pool.remove(c) end expect(ActiveRecord::Base.connection_pool.connections.length).to eq(1) - expect(@thread_count).to eq(Thread.list.count) + wait_for do + @thread_count == Thread.list.count + end end it 'can disable stats' do