feat(healthcheck): log out last error when auto healing VPN
This commit is contained in:
@@ -53,7 +53,7 @@ func (s *Server) runHealthcheckLoop(ctx context.Context, done chan<- struct{}) {
|
|||||||
select {
|
select {
|
||||||
case <-s.vpn.healthyTimer.C:
|
case <-s.vpn.healthyTimer.C:
|
||||||
timeoutIndex = 0 // retry next with the smallest timeout
|
timeoutIndex = 0 // retry next with the smallest timeout
|
||||||
s.onUnhealthyVPN(ctx)
|
s.onUnhealthyVPN(ctx, err.Error())
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
case previousErr == nil && err == nil: // Nth success
|
case previousErr == nil && err == nil: // Nth success
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ type vpnHealth struct {
|
|||||||
healthyTimer *time.Timer
|
healthyTimer *time.Timer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) onUnhealthyVPN(ctx context.Context) {
|
func (s *Server) onUnhealthyVPN(ctx context.Context, lastErrMessage string) {
|
||||||
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 (healthcheck error: " + lastErrMessage + ")")
|
||||||
s.logger.Info("👉 See https://github.com/qdm12/gluetun-wiki/blob/main/faq/healthcheck.md")
|
s.logger.Info("👉 See https://github.com/qdm12/gluetun-wiki/blob/main/faq/healthcheck.md")
|
||||||
s.logger.Info("DO NOT OPEN AN ISSUE UNLESS YOU READ AND TRIED EACH POSSIBLE SOLUTION")
|
s.logger.Info("DO NOT OPEN AN ISSUE UNLESS YOU READ AND TRIED EACH POSSIBLE SOLUTION")
|
||||||
_, _ = s.vpn.loop.ApplyStatus(ctx, constants.Stopped)
|
_, _ = s.vpn.loop.ApplyStatus(ctx, constants.Stopped)
|
||||||
|
|||||||
Reference in New Issue
Block a user