Skip to content
This repository was archived by the owner on Sep 17, 2019. It is now read-only.

Commit 4e7985d

Browse files
committed
Addresses #28 - connection timeout bug
1 parent ae51d77 commit 4e7985d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/logstash/outputs/jdbc.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class LogStash::Outputs::Jdbc < LogStash::Outputs::Base
4444
config :max_pool_size, :validate => :number, :default => 5
4545

4646
# Connection timeout
47-
config :connection_timeout, :validate => :number, :default => 2800
47+
config :connection_timeout, :validate => :number, :default => 10000
4848

4949
# We buffer a certain number of events before flushing that out to SQL.
5050
# This setting controls how many events will be buffered before sending a
@@ -156,9 +156,11 @@ def setup_and_test_pool!
156156
@pool.setMaximumPoolSize(@max_pool_size)
157157
@pool.setConnectionTimeout(@connection_timeout)
158158

159+
validate_connection_timeout = (@connection_timeout / 1000) / 2
160+
159161
# Test connection
160162
test_connection = @pool.getConnection()
161-
unless test_connection.isValid(10)
163+
unless test_connection.isValid(validate_connection_timeout)
162164
@logger.error("JDBC - Connection is not valid. Please check connection string or that your JDBC endpoint is available.")
163165
end
164166
test_connection.close()

logstash-output-jdbc.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'logstash-output-jdbc'
3-
s.version = "0.2.2"
3+
s.version = "0.2.3"
44
s.licenses = [ "Apache License (2.0)" ]
55
s.summary = "This plugin allows you to output to SQL, via JDBC"
66
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"

0 commit comments

Comments
 (0)