2
0

Add common ThreadingHelper module for specs (#29116)

This commit is contained in:
Matt Jankowski
2024-02-07 09:53:29 -05:00
committed by GitHub
parent dbafec88e5
commit 95da28d201
6 changed files with 40 additions and 57 deletions

View File

@@ -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