From a3510e391de264e87361f402a1903877cc91c8f3 Mon Sep 17 00:00:00 2001 From: Cody Roseborough Date: Thu, 17 Nov 2016 14:59:08 -0800 Subject: [PATCH] Makes plugin healthchecks less aggressive Lengthens the timeout for plugin health checks in order to be less aggressive about killing plugins. --- control/available_plugin.go | 2 +- control/monitor.go | 2 +- control/monitor_test.go | 2 +- control/plugin/plugin.go | 2 +- control/plugin/session_deprecated.go | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/control/available_plugin.go b/control/available_plugin.go index 6d51b9ed1..b2e004931 100644 --- a/control/available_plugin.go +++ b/control/available_plugin.go @@ -46,7 +46,7 @@ const ( // DefaultClientTimeout - default timeout for a client connection attempt DefaultClientTimeout = time.Second * 10 // DefaultHealthCheckTimeout - default timeout for a health check - DefaultHealthCheckTimeout = time.Second * 1 + DefaultHealthCheckTimeout = time.Second * 10 // DefaultHealthCheckFailureLimit - how any consecutive health check timeouts must occur to trigger a failure DefaultHealthCheckFailureLimit = 3 ) diff --git a/control/monitor.go b/control/monitor.go index f075661c3..61944bd69 100644 --- a/control/monitor.go +++ b/control/monitor.go @@ -28,7 +28,7 @@ const ( MonitorStarted // DefaultMonitorDuration - the default monitor duration. - DefaultMonitorDuration = time.Second * 1 + DefaultMonitorDuration = time.Second * 5 ) type monitorState int diff --git a/control/monitor_test.go b/control/monitor_test.go index 7fe5753de..de4e657a7 100644 --- a/control/monitor_test.go +++ b/control/monitor_test.go @@ -98,7 +98,7 @@ func TestMonitor(t *testing.T) { oldOpt := m.Option(MonitorDurationOption(time.Millisecond * 200)) So(m.duration, ShouldResemble, time.Millisecond*200) m.Option(oldOpt) - So(m.duration, ShouldResemble, time.Second*1) + So(m.duration, ShouldResemble, time.Second*5) }) }) } diff --git a/control/plugin/plugin.go b/control/plugin/plugin.go index 95bf79a71..43d192fe4 100644 --- a/control/plugin/plugin.go +++ b/control/plugin/plugin.go @@ -80,7 +80,7 @@ const ( var ( // Timeout settings // How much time must elapse before a lack of Ping results in a timeout - PingTimeoutDurationDefault = time.Millisecond * 1500 + PingTimeoutDurationDefault = time.Second * 10 // Array matching plugin type enum to a string // note: in string representation we use lower case diff --git a/control/plugin/session_deprecated.go b/control/plugin/session_deprecated.go index 9506bb058..32174b65d 100644 --- a/control/plugin/session_deprecated.go +++ b/control/plugin/session_deprecated.go @@ -203,6 +203,7 @@ func (s *SessionState) generateResponse(r *Response) []byte { func (s *SessionState) heartbeatWatch(killChan chan int) { s.logger.Debug("Heartbeat started") count := 0 + s.ResetHeartbeat() for { if time.Since(s.LastPing) >= s.PingTimeoutDuration { count++