fix(health): log link to Wiki on VPN restart
This commit is contained in:
@@ -15,6 +15,7 @@ func (s *Server) runHealthcheckLoop(ctx context.Context, done chan<- struct{}) {
|
|||||||
|
|
||||||
for {
|
for {
|
||||||
previousErr := s.handler.getErr()
|
previousErr := s.handler.getErr()
|
||||||
|
fmt.Println("==== previous err: ", previousErr)
|
||||||
|
|
||||||
const healthcheckTimeout = 3 * time.Second
|
const healthcheckTimeout = 3 * time.Second
|
||||||
healthcheckCtx, healthcheckCancel := context.WithTimeout(
|
healthcheckCtx, healthcheckCancel := context.WithTimeout(
|
||||||
@@ -29,7 +30,7 @@ func (s *Server) runHealthcheckLoop(ctx context.Context, done chan<- struct{}) {
|
|||||||
s.vpn.healthyTimer.Stop()
|
s.vpn.healthyTimer.Stop()
|
||||||
s.vpn.healthyWait = *s.config.VPN.Initial
|
s.vpn.healthyWait = *s.config.VPN.Initial
|
||||||
} else if previousErr == nil && err != nil {
|
} else if previousErr == nil && err != nil {
|
||||||
s.logger.Info("unhealthy: " + err.Error() + "(see https://github.com/qdm12/gluetun/wiki/Healthcheck)")
|
s.logger.Info("unhealthy: " + err.Error())
|
||||||
s.vpn.healthyTimer.Stop()
|
s.vpn.healthyTimer.Stop()
|
||||||
s.vpn.healthyTimer = time.NewTimer(s.vpn.healthyWait)
|
s.vpn.healthyTimer = time.NewTimer(s.vpn.healthyWait)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ type vpnHealth struct {
|
|||||||
|
|
||||||
func (s *Server) onUnhealthyVPN(ctx context.Context) {
|
func (s *Server) onUnhealthyVPN(ctx context.Context) {
|
||||||
s.logger.Info("program has been unhealthy for " +
|
s.logger.Info("program has been unhealthy for " +
|
||||||
s.vpn.healthyWait.String() + ": restarting VPN")
|
s.vpn.healthyWait.String() + ": restarting VPN " +
|
||||||
|
"(see https://github.com/qdm12/gluetun/wiki/Healthcheck)")
|
||||||
_, _ = s.vpn.loop.ApplyStatus(ctx, constants.Stopped)
|
_, _ = s.vpn.loop.ApplyStatus(ctx, constants.Stopped)
|
||||||
_, _ = s.vpn.loop.ApplyStatus(ctx, constants.Running)
|
_, _ = s.vpn.loop.ApplyStatus(ctx, constants.Running)
|
||||||
s.vpn.healthyWait += *s.config.VPN.Addition
|
s.vpn.healthyWait += *s.config.VPN.Addition
|
||||||
|
|||||||
Reference in New Issue
Block a user