Addresses #28 - connection timeout bug

This commit is contained in:
Karl Southern 2016-02-16 15:29:08 +00:00
parent ae51d77f05
commit 4e7985dafd
2 changed files with 5 additions and 3 deletions

View File

@ -44,7 +44,7 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
config :max_pool_size, :validate => :number, :default => 5
# Connection timeout
config :connection_timeout, :validate => :number, :default => 2800
config :connection_timeout, :validate => :number, :default => 10000
# We buffer a certain number of events before flushing that out to SQL.
# This setting controls how many events will be buffered before sending a
@ -156,9 +156,11 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
@pool.setMaximumPoolSize(@max_pool_size)
@pool.setConnectionTimeout(@connection_timeout)
validate_connection_timeout = (@connection_timeout / 1000) / 2
# Test connection
test_connection = @pool.getConnection()
unless test_connection.isValid(10)
unless test_connection.isValid(validate_connection_timeout)
@logger.error("JDBC - Connection is not valid. Please check connection string or that your JDBC endpoint is available.")
end
test_connection.close()

View File

@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'logstash-output-jdbc'
s.version = "0.2.2"
s.version = "0.2.3"
s.licenses = [ "Apache License (2.0)" ]
s.summary = "This plugin allows you to output to SQL, via JDBC"
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"