#282: added timeout flags & tuned client.IsIdle()
This commit is contained in:
parent
72b9eb443c
commit
3067b06bf6
@ -367,7 +367,10 @@ func (client *Client) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) IsIdle() bool {
|
func (client *Client) IsIdle() bool {
|
||||||
return time.Since(client.lastQueryTime).Hours() > 1
|
if command.Opts.ConnectionIdleTimeoutDisabled {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return time.Since(client.lastQueryTime).Minutes() > command.Opts.ConnectionIdleTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch all rows as strings for a single column
|
// Fetch all rows as strings for a single column
|
||||||
|
@ -34,6 +34,8 @@ type Options struct {
|
|||||||
ConnectBackend string `long:"connect-backend" description:"Enable database authentication through a third party backend"`
|
ConnectBackend string `long:"connect-backend" description:"Enable database authentication through a third party backend"`
|
||||||
ConnectToken string `long:"connect-token" description:"Authentication token for the third-party connect backend"`
|
ConnectToken string `long:"connect-token" description:"Authentication token for the third-party connect backend"`
|
||||||
ConnectHeaders string `long:"connect-headers" description:"List of headers to pass to the connect backend"`
|
ConnectHeaders string `long:"connect-headers" description:"List of headers to pass to the connect backend"`
|
||||||
|
ConnectionIdleTimeoutDisabled bool `long:"disable-connection-idle-timeout" description:"Disable connection idle timeout" default:"false"`
|
||||||
|
ConnectionIdleTimeout float64 `long:"idle-timeout" description:"Set connection idle timeout in minutes" default:"180"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var Opts Options
|
var Opts Options
|
||||||
|
Loading…
x
Reference in New Issue
Block a user