properly close docker client

This commit is contained in:
yusing 2024-12-13 12:54:54 +08:00
parent 68b2d79700
commit 51b8806184
2 changed files with 2 additions and 0 deletions

View file

@ -98,6 +98,7 @@ func (r *HTTPRoute) Start(providerSubtask task.Task) E.Error {
if err == nil {
fallback := monitor.NewHTTPHealthChecker(r.rp.TargetURL, r.HealthCheck)
r.HealthMon = monitor.NewDockerHealthMonitor(client, r.Idlewatcher.ContainerID, r.HealthCheck, fallback)
r.task.OnCancel("close docker client", client.Close)
}
}
if r.HealthMon == nil {

View file

@ -73,6 +73,7 @@ func (r *StreamRoute) Start(providerSubtask task.Task) E.Error {
if err == nil {
fallback := monitor.NewRawHealthChecker(r.TargetURL(), r.HealthCheck)
r.HealthMon = monitor.NewDockerHealthMonitor(client, r.Idlewatcher.ContainerID, r.HealthCheck, fallback)
r.task.OnCancel("close docker client", client.Close)
}
}
if r.HealthMon == nil {