Skip to content

Commit

Permalink
fix Lint/HashCompareByIdentity linter
Browse files Browse the repository at this point in the history
  • Loading branch information
geemus committed Jan 13, 2021
1 parent 3c77619 commit 8ac7cbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/excon/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,14 @@ def socket

def sockets
@_excon_sockets ||= {}
@_excon_sockets.compare_by_identity

if @data[:thread_safe_sockets]
# In a multi-threaded world, if the same connection is used by multiple
# threads at the same time to connect to the same destination, they may
# stomp on each other's sockets. This ensures every thread gets their
# own socket cache, within the context of a single connection.
@_excon_sockets[Thread.current.object_id] ||= {}
@_excon_sockets[Thread.current] ||= {}
else
@_excon_sockets
end
Expand Down

0 comments on commit 8ac7cbf

Please sign in to comment.