Sha256: 36778cd896b2df572e1ff70fe387b9e9749bbc313bd4f847252b268587c6d5ac

Contents?: true

Size: 809 Bytes

Versions: 21

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true

require_relative '../../polyphony'

require 'redis-client'

class RedisClient
  class RubyConnection
    class BufferedIO
      def fill_buffer(strict, size = @chunk_size)
        remaining = size
        empty_buffer = @offset >= @buffer.bytesize

        loop do
          max_read = [remaining, @chunk_size].max
          bytes = if empty_buffer
            @io.readpartial(max_read, @buffer)
          else
            @io.readpartial(max_read)
          end

          raise Errno::ECONNRESET if bytes.nil?

          if empty_buffer
            @offset = 0
            empty_buffer = false
          else
            @buffer << bytes
          end
          remaining -= bytes.bytesize
          return if !strict || remaining <= 0
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
polyphony-1.6 lib/polyphony/adapters/redis.rb
polyphony-1.5 lib/polyphony/adapters/redis.rb
polyphony-1.4 lib/polyphony/adapters/redis.rb
polyphony-1.3 lib/polyphony/adapters/redis.rb
polyphony-1.2.1 lib/polyphony/adapters/redis.rb
polyphony-1.2 lib/polyphony/adapters/redis.rb
polyphony-1.1.1 lib/polyphony/adapters/redis.rb
polyphony-1.1 lib/polyphony/adapters/redis.rb
polyphony-1.0.2 lib/polyphony/adapters/redis.rb
polyphony-1.0.1 lib/polyphony/adapters/redis.rb
polyphony-1.0 lib/polyphony/adapters/redis.rb
polyphony-0.99.6 lib/polyphony/adapters/redis.rb
polyphony-0.99.5 lib/polyphony/adapters/redis.rb
polyphony-0.99.4 lib/polyphony/adapters/redis.rb
polyphony-0.99.3 lib/polyphony/adapters/redis.rb
polyphony-0.99.2 lib/polyphony/adapters/redis.rb
polyphony-0.99.1 lib/polyphony/adapters/redis.rb
polyphony-0.99 lib/polyphony/adapters/redis.rb
polyphony-0.98 lib/polyphony/adapters/redis.rb
polyphony-0.97 lib/polyphony/adapters/redis.rb