Files
gluetun/internal/healthcheck/openvpn.go
Quentin McGaw (desktop) 6f58f84151 Maint: improve health code
2021-07-22 20:18:52 +00:00

18 lines
508 B
Go

package healthcheck
import (
"context"
"time"
"github.com/qdm12/gluetun/internal/constants"
)
func (s *server) onUnhealthyOpenvpn(ctx context.Context) {
s.logger.Info("program has been unhealthy for " +
s.openvpn.healthyWait.String() + ": restarting OpenVPN")
_, _ = s.openvpn.looper.ApplyStatus(ctx, constants.Stopped)
_, _ = s.openvpn.looper.ApplyStatus(ctx, constants.Running)
s.openvpn.healthyWait += s.config.OpenVPN.Addition
s.openvpn.healthyTimer = time.NewTimer(s.openvpn.healthyWait)
}