Skip to content

Commit

Permalink
out_http: Use snake case
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Norbert Menges <christian.norbert.menges@sap.com>
  • Loading branch information
Garfield96 committed Dec 14, 2023
1 parent 7ba811d commit 87135fc
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/fluent/plugin/out_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,23 @@ def initialize
@proxy_uri = nil
@formatter = nil

@Cache = []
@CacheIdMutex = Mutex.new
@CacheEntry = Struct.new(:uri, :conn)
@cache = []
@cache_id_mutex = Mutex.new
@cache_entry = Struct.new(:uri, :conn)
end

def close
super

# Close all open connections
@Cache.each {|entry| entry.conn.finish if entry.conn&.started? }
@cache.each {|entry| entry.conn.finish if entry.conn&.started? }
end

def configure(conf)
super

@Cache = Array.new(actual_flush_thread_count, @CacheEntry.new("", nil)) if @reuse_connections
@CacheId = 0
@cache = Array.new(actual_flush_thread_count, @cache_entry.new("", nil)) if @reuse_connections
@cache_id = 0

if @retryable_response_codes.nil?
log.warn('Status code 503 is going to be removed from default `retryable_response_codes` from fluentd v2. Please add it by yourself if you wish')
Expand Down Expand Up @@ -263,23 +263,23 @@ def create_request(chunk, uri)
def make_request_cached(uri, req)
id = Thread.current.thread_variable_get(plugin_id)
if id.nil?
@CacheIdMutex.synchronize {
id = @CacheId
@CacheId += 1
@cache_id_mutex.synchronize {
id = @cache_id
@cache_id += 1
}
Thread.current.thread_variable_set(plugin_id, id)
end
uri_str = uri.to_s
if @Cache[id].uri != uri_str
@Cache[id].conn.finish if @Cache[id].conn&.started?
if @cache[id].uri != uri_str
@cache[id].conn.finish if @cache[id].conn&.started?
http = if @proxy_uri
Net::HTTP.start(uri.host, uri.port, @proxy_uri.host, @proxy_uri.port, @proxy_uri.user, @proxy_uri.password, @http_opt)
else
Net::HTTP.start(uri.host, uri.port, @http_opt)
end
@Cache[id] = @CacheEntry.new(uri_str, http)
@cache[id] = @cache_entry.new(uri_str, http)
end
@Cache[id].conn.request(req)
@cache[id].conn.request(req)
end

def make_request(uri, req)
Expand Down

0 comments on commit 87135fc

Please sign in to comment.