Addresses #28 - connection timeout bug
This commit is contained in:
parent
ae51d77f05
commit
4e7985dafd
|
@ -44,7 +44,7 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
|
||||||
config :max_pool_size, :validate => :number, :default => 5
|
config :max_pool_size, :validate => :number, :default => 5
|
||||||
|
|
||||||
# Connection timeout
|
# 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.
|
# 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
|
# 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.setMaximumPoolSize(@max_pool_size)
|
||||||
@pool.setConnectionTimeout(@connection_timeout)
|
@pool.setConnectionTimeout(@connection_timeout)
|
||||||
|
|
||||||
|
validate_connection_timeout = (@connection_timeout / 1000) / 2
|
||||||
|
|
||||||
# Test connection
|
# Test connection
|
||||||
test_connection = @pool.getConnection()
|
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.")
|
@logger.error("JDBC - Connection is not valid. Please check connection string or that your JDBC endpoint is available.")
|
||||||
end
|
end
|
||||||
test_connection.close()
|
test_connection.close()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = 'logstash-output-jdbc'
|
s.name = 'logstash-output-jdbc'
|
||||||
s.version = "0.2.2"
|
s.version = "0.2.3"
|
||||||
s.licenses = [ "Apache License (2.0)" ]
|
s.licenses = [ "Apache License (2.0)" ]
|
||||||
s.summary = "This plugin allows you to output to SQL, via JDBC"
|
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"
|
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"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user