mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-21 17:10:14 +01:00
Merge branch 'main' into feat/agent-stream-rebased
This commit is contained in:
@@ -35,7 +35,7 @@ func NewDockerHealthcheckState(client *docker.SharedClient, containerId string)
|
||||
}
|
||||
}
|
||||
|
||||
func Docker(ctx context.Context, state *DockerHealthcheckState, containerId string, timeout time.Duration) (types.HealthCheckResult, error) {
|
||||
func Docker(ctx context.Context, state *DockerHealthcheckState, timeout time.Duration) (types.HealthCheckResult, error) {
|
||||
if state.numDockerFailures > dockerFailuresThreshold {
|
||||
return types.HealthCheckResult{}, ErrDockerHealthCheckFailedTooManyTimes
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func Docker(ctx context.Context, state *DockerHealthcheckState, containerId stri
|
||||
defer cancel()
|
||||
|
||||
// the actual inspect response is intercepted and returned as RequestInterceptedError
|
||||
_, err := state.client.ContainerInspect(ctx, containerId, client.ContainerInspectOptions{})
|
||||
_, err := state.client.ContainerInspect(ctx, state.containerId, client.ContainerInspectOptions{})
|
||||
|
||||
var interceptedErr *httputils.RequestInterceptedError
|
||||
if !httputils.AsRequestInterceptedError(err, &interceptedErr) {
|
||||
|
||||
@@ -106,6 +106,11 @@ func processHealthResponse(lat time.Duration, err error, getStatusCode func() in
|
||||
Detail: err.Error(),
|
||||
}, nil
|
||||
}
|
||||
return types.HealthCheckResult{
|
||||
Latency: lat,
|
||||
Healthy: true,
|
||||
Detail: tlsErr.Error(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
statusCode := getStatusCode()
|
||||
|
||||
@@ -42,7 +42,7 @@ type (
|
||||
|
||||
var ErrNegativeInterval = gperr.New("negative interval")
|
||||
|
||||
func (mon *monitor) init(u *url.URL, cfg types.HealthCheckConfig, healthCheckFunc HealthCheckFunc) *monitor {
|
||||
func (mon *monitor) init(u *url.URL, cfg types.HealthCheckConfig, healthCheckFunc HealthCheckFunc) {
|
||||
if state := config.WorkingState.Load(); state != nil {
|
||||
cfg.ApplyDefaults(state.Value().Defaults.HealthCheck)
|
||||
} else {
|
||||
@@ -60,7 +60,6 @@ func (mon *monitor) init(u *url.URL, cfg types.HealthCheckConfig, healthCheckFun
|
||||
} else {
|
||||
mon.url.Store(u)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mon *monitor) Context() context.Context {
|
||||
|
||||
@@ -98,7 +98,7 @@ func NewDockerHealthMonitor(config types.HealthCheckConfig, client *docker.Share
|
||||
|
||||
var mon monitor
|
||||
mon.init(displayURL, config, func(u *url.URL) (result Result, err error) {
|
||||
result, err = healthcheck.Docker(mon.Context(), state, containerId, config.Timeout)
|
||||
result, err = healthcheck.Docker(mon.Context(), state, config.Timeout)
|
||||
if err != nil {
|
||||
if isFirstFailure {
|
||||
isFirstFailure = false
|
||||
|
||||
Reference in New Issue
Block a user