2021-07-18 03:17:48 +00:00
|
|
|
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 " +
|
2021-07-22 20:13:20 +00:00
|
|
|
s.openvpn.currentHealthyWait.String() + ": restarting OpenVPN")
|
2021-07-18 03:17:48 +00:00
|
|
|
_, _ = s.openvpn.looper.ApplyStatus(ctx, constants.Stopped)
|
|
|
|
|
_, _ = s.openvpn.looper.ApplyStatus(ctx, constants.Running)
|
2021-07-22 20:13:20 +00:00
|
|
|
s.openvpn.currentHealthyWait += s.openvpn.healthyWaitConfig.Addition
|
|
|
|
|
s.openvpn.healthyTimer = time.NewTimer(s.openvpn.currentHealthyWait)
|
2021-07-18 03:17:48 +00:00
|
|
|
}
|