diff options
author | 2018-11-20 08:48:56 +0100 | |
---|---|---|
committer | 2018-11-20 08:48:56 +0100 | |
commit | a1d92c51cd93a83dd2936f4b857b155d5d321a26 (patch) | |
tree | 9c40966fe6651c294734116946fcd30a193046cf /plugin/forward/persistent.go | |
parent | e94ce7a12ae6e7fdf977ad94aade3effd44ed399 (diff) | |
download | coredns-a1d92c51cd93a83dd2936f4b857b155d5d321a26.tar.gz coredns-a1d92c51cd93a83dd2936f4b857b155d5d321a26.tar.zst coredns-a1d92c51cd93a83dd2936f4b857b155d5d321a26.zip |
plugin/forward: remove dynamic read timeout (#2319)
* plugin/forward: remove dynamic read timeout
We care about an upstream being there, so we still have a dynamic dial
time out (by way higher then 200ms) of 1s; this should be fairly stable
for an upstream. The read timeout if more variable because of cached and
non cached responses. As such remove his logic entirely.
Drop to 2s read timeout.
Fixes #2306
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/forward/persistent.go')
-rw-r--r-- | plugin/forward/persistent.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugin/forward/persistent.go b/plugin/forward/persistent.go index fabdc70b2..d1348f94d 100644 --- a/plugin/forward/persistent.go +++ b/plugin/forward/persistent.go @@ -31,7 +31,7 @@ type Transport struct { func newTransport(addr string) *Transport { t := &Transport{ - avgDialTime: int64(defaultDialTimeout / 2), + avgDialTime: int64(maxDialTimeout / 2), conns: make(map[string][]*persistConn), expire: defaultExpire, addr: addr, @@ -159,8 +159,10 @@ func (t *Transport) SetExpire(expire time.Duration) { t.expire = expire } func (t *Transport) SetTLSConfig(cfg *tls.Config) { t.tlsConfig = cfg } const ( - defaultExpire = 10 * time.Second - minDialTimeout = 100 * time.Millisecond - maxDialTimeout = 30 * time.Second - defaultDialTimeout = 30 * time.Second + defaultExpire = 10 * time.Second + minDialTimeout = 1 * time.Second + maxDialTimeout = 30 * time.Second + + // Some resolves might take quite a while, usually (cached) responses are fast. Set to 2s to give us some time to retry a different upstream. + readTimeout = 2 * time.Second ) |