Skip to content

Commit fb32a4d

Browse files
committed
Default to a per-thread client cache. Fixes #31.
1 parent 5abb2e6 commit fb32a4d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/async/http/faraday/clients.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,14 @@ def close
164164

165165
protected
166166

167+
def make_clients
168+
PersistentClients.new(**@options, &@block)
169+
end
170+
167171
def clients
168-
Thread.current[@key] ||= PersistentClients.new(**@options, &@block)
172+
thread = Thread.current
173+
174+
return thread.thread_variable_get(@key) || thread.thread_variable_set(@key, make_clients)
169175
end
170176
end
171177
end

0 commit comments

Comments
 (0)