mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-12-05 00:02:12 -05:00
linting
This commit is contained in:
parent
e8be009c7c
commit
10b0715fc5
@ -316,7 +316,7 @@ module HTTPX
|
||||
# * the number of inflight requests
|
||||
# * the number of pending requests
|
||||
# * whether the write buffer has bytes (i.e. for close handshake)
|
||||
if @pending.size.zero? && @inflight.zero? && @write_buffer.empty?
|
||||
if @pending.empty? && @inflight.zero? && @write_buffer.empty?
|
||||
log(level: 3) { "NO MORE REQUESTS..." }
|
||||
return
|
||||
end
|
||||
@ -360,7 +360,7 @@ module HTTPX
|
||||
break if @state == :closing || @state == :closed
|
||||
|
||||
# exit #consume altogether if all outstanding requests have been dealt with
|
||||
return if @pending.size.zero? && @inflight.zero?
|
||||
return if @pending.empty? && @inflight.zero?
|
||||
end unless ((ints = interests).nil? || ints == :w || @state == :closing) && !epiped
|
||||
|
||||
#
|
||||
|
||||
@ -365,7 +365,7 @@ module HTTPX
|
||||
ex.set_backtrace(caller)
|
||||
handle_error(ex)
|
||||
end
|
||||
return unless is_connection_closed && @streams.size.zero?
|
||||
return unless is_connection_closed && @streams.empty?
|
||||
|
||||
emit(:close, is_connection_closed)
|
||||
end
|
||||
|
||||
@ -100,7 +100,7 @@ module HTTPX
|
||||
end
|
||||
|
||||
def def_option(optname, *args, &block)
|
||||
if args.size.zero? && !block
|
||||
if args.empty? && !block
|
||||
class_eval(<<-OUT, __FILE__, __LINE__ + 1)
|
||||
def option_#{optname}(v); v; end # def option_smth(v); v; end
|
||||
OUT
|
||||
|
||||
@ -138,7 +138,7 @@ module HTTPX
|
||||
def each(&blk)
|
||||
return enum_for(__method__) unless blk
|
||||
|
||||
return deflate(&blk) if @buffer.size.zero?
|
||||
return deflate(&blk) if @buffer.empty?
|
||||
|
||||
@buffer.rewind
|
||||
@buffer.each(&blk)
|
||||
@ -152,7 +152,7 @@ module HTTPX
|
||||
private
|
||||
|
||||
def deflate(&blk)
|
||||
return unless @buffer.size.zero?
|
||||
return unless @buffer.empty?
|
||||
|
||||
@body.rewind
|
||||
@deflater.deflate(@body, @buffer, chunk_size: 16_384, &blk)
|
||||
|
||||
@ -56,7 +56,7 @@ module HTTPX
|
||||
|
||||
class Inflater
|
||||
def initialize(bytesize)
|
||||
@inflater = Zlib::Inflate.new(32 + Zlib::MAX_WBITS)
|
||||
@inflater = Zlib::Inflate.new(Zlib::MAX_WBITS + 32)
|
||||
@bytesize = bytesize
|
||||
@buffer = nil
|
||||
end
|
||||
|
||||
@ -57,7 +57,7 @@ module HTTPX
|
||||
|
||||
yield data
|
||||
|
||||
message = message.byteslice((5 + size)..-1)
|
||||
message = message.byteslice((size + 5)..-1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ module HTTPX
|
||||
ConnectionError,
|
||||
Connection::HTTP2::GoawayError,
|
||||
].freeze
|
||||
DEFAULT_JITTER = ->(interval) { interval * (0.5 * (1 + rand)) }
|
||||
DEFAULT_JITTER = ->(interval) { interval * ((rand + 1) * 0.5) }
|
||||
|
||||
if ENV.key?("HTTPX_NO_JITTER")
|
||||
def self.extra_options(options)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user