Skip to content

Commit

Permalink
Add mutex around stub api_requests (#2971)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextwoods authored Dec 20, 2023
1 parent 6315c75 commit 3445b5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions gems/aws-sdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Add mutex around stub api_requests.

3.190.0 (2023-11-29)
------------------

Expand Down
13 changes: 8 additions & 5 deletions gems/aws-sdk-core/lib/aws-sdk-core/client_stubs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ def setup_stubbing
@api_requests = []

requests = @api_requests
requests_mutex = Mutex.new
self.handle do |context|
requests << {
operation_name: context.operation_name,
params: context.params,
context: context
}
requests_mutex.synchronize do
requests << {
operation_name: context.operation_name,
params: context.params,
context: context
}
end
@handler.call(context)
end
end
Expand Down

0 comments on commit 3445b5d

Please sign in to comment.