Add common ThreadingHelper module for specs (#29116)
This commit is contained in:
@@ -1035,19 +1035,10 @@ RSpec.describe Account do
|
||||
it 'increments the count in multi-threaded an environment when account_stat is not yet initialized' do
|
||||
subject
|
||||
|
||||
increment_by = 15
|
||||
wait_for_start = true
|
||||
|
||||
threads = Array.new(increment_by) do
|
||||
Thread.new do
|
||||
true while wait_for_start
|
||||
described_class.find(subject.id).increment_count!(:followers_count)
|
||||
end
|
||||
multi_threaded_execution(15) do
|
||||
described_class.find(subject.id).increment_count!(:followers_count)
|
||||
end
|
||||
|
||||
wait_for_start = false
|
||||
threads.each(&:join)
|
||||
|
||||
expect(subject.reload.followers_count).to eq 15
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user