[Shopify Sync] Use Concurrent::Set for thread-safety #88
+19
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Cherry-picks Shopify's thread-safety improvement (commit
2821988). Replaces standard RubySetwithConcurrent::Setto ensure thread-safe operations in parallel test execution.Changes
Modified Files
ruby/lib/ci/queue/redis/worker.rb- UseConcurrent::Set, addreserved_testsaccessorruby/lib/ci/queue/static.rb- Addreserved_testsmethod withConcurrent::Setruby/test/integration/minitest_redis_test.rb- Updated tests, added requireruby/test/minitest/queue/build_status_recorder_test.rb- Updated test helperThe Problem
Standard Ruby
Setis not thread-safe. In parallel test execution, concurrent modifications toSetobjects can cause:The Solution
Concurrent::Setfrom theconcurrent-rubygem (already a dependency via ActiveSupport) provides:Conflict Resolution
✅ Successfully integrated with Figma's features:
@reserved_testsalongside existing@reserved_testConcurrent::SetBenefits
Testing
Original Shopify PR
2821988Risk Assessment
Risk Level: Low
Notes
This change adds
@reserved_tests(Set) alongside Figma's existing@reserved_test(single value). Both can coexist:@reserved_testtracks the currently executing test@reserved_teststracks all reserved tests in the workercc: @Dkeegan