mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
54610866f2
- return concrete struct type - Add compilation checks for implementations
25 lines
667 B
Go
25 lines
667 B
Go
package healthcheck
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/qdm12/gluetun/internal/constants"
|
|
"github.com/qdm12/gluetun/internal/openvpn"
|
|
)
|
|
|
|
type openvpnHealth struct {
|
|
looper openvpn.Looper
|
|
healthyWait time.Duration
|
|
healthyTimer *time.Timer
|
|
}
|
|
|
|
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)
|
|
}
|