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