From b1a5f45d2c60307961fb98870bbabfae2e430aa9 Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Wed, 3 May 2017 13:45:27 -0700 Subject: [PATCH] Fix parsing the connection duration when it's nil --- plugins/helper/database/connutil/cassandra.go | 3 +++ plugins/helper/database/connutil/sql.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/helper/database/connutil/cassandra.go b/plugins/helper/database/connutil/cassandra.go index 27fb25195..958bef201 100644 --- a/plugins/helper/database/connutil/cassandra.go +++ b/plugins/helper/database/connutil/cassandra.go @@ -48,6 +48,9 @@ func (c *CassandraConnectionProducer) Initialize(conf map[string]interface{}, ve } c.Initialized = true + if c.ConnectTimeoutRaw == nil { + c.ConnectTimeoutRaw = "0s" + } c.connectTimeout, err = parseutil.ParseDurationSecond(c.ConnectTimeoutRaw) if err != nil { return fmt.Errorf("invalid connect_timeout: %s", err) diff --git a/plugins/helper/database/connutil/sql.go b/plugins/helper/database/connutil/sql.go index 4a6368560..5067e10d7 100644 --- a/plugins/helper/database/connutil/sql.go +++ b/plugins/helper/database/connutil/sql.go @@ -48,7 +48,7 @@ func (c *SQLConnectionProducer) Initialize(conf map[string]interface{}, verifyCo if c.MaxIdleConnections > c.MaxOpenConnections { c.MaxIdleConnections = c.MaxOpenConnections } - if c.MaxConnectionLifetimeRaw == "" { + if c.MaxConnectionLifetimeRaw == nil { c.MaxConnectionLifetimeRaw = "0s" }