mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 02:09:01 +02:00
fix docker client panic introduced in last patch
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
docker_events "github.com/docker/docker/api/types/events"
|
docker_events "github.com/docker/docker/api/types/events"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"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"
|
E "github.com/yusing/go-proxy/internal/error"
|
||||||
"github.com/yusing/go-proxy/internal/watcher/events"
|
"github.com/yusing/go-proxy/internal/watcher/events"
|
||||||
)
|
)
|
||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
type (
|
type (
|
||||||
DockerWatcher struct {
|
DockerWatcher struct {
|
||||||
host string
|
host string
|
||||||
client *D.SharedClient
|
client *docker.SharedClient
|
||||||
}
|
}
|
||||||
DockerListOptions = docker_events.ListOptions
|
DockerListOptions = docker_events.ListOptions
|
||||||
)
|
)
|
||||||
@@ -66,6 +66,13 @@ func (w DockerWatcher) EventsWithOptions(ctx context.Context, options DockerList
|
|||||||
w.client.Close()
|
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)
|
cEventCh, cErrCh := w.client.Events(ctx, options)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|||||||
Reference in New Issue
Block a user