Skip to content

Commit

Permalink
Merge pull request #38 from Shopify/grcooper/remove-fake-nonblocking
Browse files Browse the repository at this point in the history
Remove readfull, ruby does nonblocking in C
  • Loading branch information
grcooper authored Feb 3, 2025
2 parents 8e8e405 + 59c04ba commit 6104ccd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion lib/dalli/protocol/connection_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def read_line
end

def read(count)
@sock.readfull(count)
@sock.read(count)
rescue SystemCallError, *TIMEOUT_ERRORS, EOFError => e
error_on_request!(e)
end
Expand Down
10 changes: 0 additions & 10 deletions lib/dalli/socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ module Socket
module InstanceMethods
WAIT_RCS = %i[wait_writable wait_readable].freeze

def readfull(count)
value = String.new(capacity: count + 1)
loop do
result = read_nonblock(count - value.bytesize, exception: false)
value << result if append_to_buffer?(result)
break if value.bytesize == count
end
value
end

def read_available
value = +''
loop do
Expand Down

0 comments on commit 6104ccd

Please sign in to comment.