mirror of
https://github.com/yusing/godoxy.git
synced 2025-07-05 14:24:02 +02:00
fix: nil dereference in docker health checker
This commit is contained in:
parent
d1524c1013
commit
1380b58141
1 changed files with 3 additions and 1 deletions
|
@ -25,7 +25,9 @@ func NewDockerHealthMonitor(client *docker.SharedClient, containerID, alias stri
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mon *DockerHealthMonitor) CheckHealth() (result *health.HealthCheckResult, err error) {
|
func (mon *DockerHealthMonitor) CheckHealth() (result *health.HealthCheckResult, err error) {
|
||||||
cont, err := mon.client.ContainerInspect(mon.task.Context(), mon.containerID)
|
ctx, cancel := mon.ContextWithTimeout("docker health check timed out")
|
||||||
|
defer cancel()
|
||||||
|
cont, err := mon.client.ContainerInspect(ctx, mon.containerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return mon.fallback.CheckHealth()
|
return mon.fallback.CheckHealth()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue