Top Level Namespace
Defined Under Namespace
Modules: SyslogTls
Instance Method Summary collapse
- #add_host_backoff_spec(retries_to_do, host_ip_port) ⇒ Object
- #can_write(host_ip_port) ⇒ Object
- #conatins_host(host_ip_port) ⇒ Object
- #increase_retry(host_ip_port) ⇒ Object
- #reset_tries(host_ip_port) ⇒ Object
Instance Method Details
#add_host_backoff_spec(retries_to_do, host_ip_port) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/fluent/plugin/out_syslog_tls.rb', line 24 def add_host_backoff_spec(retries_to_do, host_ip_port) # Check if an element with the same hostIPport already exists return if $host_backoff_specs_list.any? { |spec| spec.hostIPport == host_ip_port } # If not, add a new HostBackoffSpecs instance to the global array $host_backoff_specs_list << ::SyslogTls::HostBackoffSpecs.new(retries_to_do, host_ip_port) end |
#can_write(host_ip_port) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fluent/plugin/out_syslog_tls.rb', line 32 def can_write(host_ip_port) if !conatins_host(host_ip_port) add_host_backoff_spec(0, host_ip_port) end begin $host_backoff_specs_list.each do |backoff_specs| if backoff_specs.hostIPport == host_ip_port return backoff_specs.canwrite end end rescue => e return 0 end return 1 end |
#conatins_host(host_ip_port) ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/fluent/plugin/out_syslog_tls.rb', line 74 def conatins_host(host_ip_port) $host_backoff_specs_list.each do |backoff_specs| if backoff_specs.hostIPport == host_ip_port return true end end return false end |
#increase_retry(host_ip_port) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fluent/plugin/out_syslog_tls.rb', line 48 def increase_retry(host_ip_port) if !conatins_host(host_ip_port) add_host_backoff_spec(0, host_ip_port) end begin $host_backoff_specs_list.each do |backoff_specs| if backoff_specs.hostIPport == host_ip_port backoff_specs.failtowrite end end rescue => e pp "Error in increase_retry: #{e.}" end end |
#reset_tries(host_ip_port) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fluent/plugin/out_syslog_tls.rb', line 63 def reset_tries(host_ip_port) if !conatins_host(host_ip_port) add_host_backoff_spec(0, host_ip_port) end $host_backoff_specs_list.each do |backoff_specs| if backoff_specs.hostIPport == host_ip_port backoff_specs.resetRetries end end end |