mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 04:42:33 +02:00
fix docker client panic introduced in last patch
This commit is contained in:
parent
7bb34b8788
commit
189c870630
1 changed files with 9 additions and 2 deletions
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
docker_events "github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
D "github.com/yusing/go-proxy/internal/docker"
|
||||
"github.com/yusing/go-proxy/internal/docker"
|
||||
E "github.com/yusing/go-proxy/internal/error"
|
||||
"github.com/yusing/go-proxy/internal/watcher/events"
|
||||
)
|
||||
|
@ -14,7 +14,7 @@ import (
|
|||
type (
|
||||
DockerWatcher struct {
|
||||
host string
|
||||
client *D.SharedClient
|
||||
client *docker.SharedClient
|
||||
}
|
||||
DockerListOptions = docker_events.ListOptions
|
||||
)
|
||||
|
@ -66,6 +66,13 @@ func (w DockerWatcher) EventsWithOptions(ctx context.Context, options DockerList
|
|||
w.client.Close()
|
||||
}()
|
||||
|
||||
client, err := docker.ConnectClient(w.host)
|
||||
if err != nil {
|
||||
errCh <- E.From(err)
|
||||
return
|
||||
}
|
||||
w.client = client
|
||||
|
||||
cEventCh, cErrCh := w.client.Events(ctx, options)
|
||||
|
||||
for {
|
||||
|
|
Loading…
Add table
Reference in a new issue