Skip to content

Commit

Permalink
Fix test adapter thread safety (#1380)
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia authored Jan 15, 2022
1 parent 996028a commit 577f0d3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/faraday/adapter/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ def match(env)
stack = @stack[request_method]
consumed = (@consumed[request_method] ||= [])

stub, meta = matches?(stack, env)
if stub
@stubs_mutex.synchronize do
@stubs_mutex.synchronize do
stub, meta = matches?(stack, env)
if stub
removed = stack.delete(stub)
consumed << removed unless removed.nil?
return stub, meta
end
return stub, meta
end
matches?(consumed, env)
end
Expand Down

0 comments on commit 577f0d3

Please sign in to comment.