mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 04:42:33 +02:00
fix idlewatcher nil dereference
This commit is contained in:
parent
89f08f0da7
commit
a0a81240ce
2 changed files with 8 additions and 8 deletions
|
@ -209,7 +209,7 @@ func (w *Watcher) resetIdleTimer() {
|
|||
w.ticker.Reset(w.IdleTimeout)
|
||||
}
|
||||
|
||||
func (w *Watcher) getEventCh(dockerWatcher watcher.DockerWatcher) (eventTask *task.Task, eventCh <-chan events.Event, errCh <-chan E.Error) {
|
||||
func (w *Watcher) getEventCh(dockerWatcher watcher.DockerWatcher) (eventCh <-chan events.Event, errCh <-chan E.Error) {
|
||||
eventCh, errCh = dockerWatcher.EventsWithOptions(w.Task().Context(), watcher.DockerListOptions{
|
||||
Filters: watcher.NewDockerFilter(
|
||||
watcher.DockerFilterContainer,
|
||||
|
@ -239,8 +239,7 @@ func (w *Watcher) getEventCh(dockerWatcher watcher.DockerWatcher) (eventTask *ta
|
|||
// errors occurred on docker client, or route provider died (mainly caused by config reload).
|
||||
func (w *Watcher) watchUntilDestroy() (returnCause error) {
|
||||
dockerWatcher := watcher.NewDockerWatcherWithClient(w.client)
|
||||
eventTask, dockerEventCh, dockerEventErrCh := w.getEventCh(dockerWatcher)
|
||||
defer eventTask.Finish("stopped")
|
||||
dockerEventCh, dockerEventErrCh := w.getEventCh(dockerWatcher)
|
||||
|
||||
for {
|
||||
select {
|
||||
|
@ -279,8 +278,7 @@ func (w *Watcher) watchUntilDestroy() (returnCause error) {
|
|||
w.Debug().Msgf("id changed %s -> %s", w.ContainerID, e.ActorID)
|
||||
w.ContainerID = e.ActorID
|
||||
// recreate event stream
|
||||
eventTask.Finish("recreate event stream")
|
||||
eventTask, dockerEventCh, dockerEventErrCh = w.getEventCh(dockerWatcher)
|
||||
dockerEventCh, dockerEventErrCh = w.getEventCh(dockerWatcher)
|
||||
}
|
||||
case <-w.ticker.C:
|
||||
w.ticker.Stop()
|
||||
|
|
|
@ -16,9 +16,11 @@ var ErrProgramExiting = errors.New("program exiting")
|
|||
|
||||
var logger = logging.With().Str("module", "task").Logger()
|
||||
|
||||
var root = newRoot()
|
||||
var allTasks = F.NewSet[*Task]()
|
||||
var allTasksWg sync.WaitGroup
|
||||
var (
|
||||
root = newRoot()
|
||||
allTasks = F.NewSet[*Task]()
|
||||
allTasksWg sync.WaitGroup
|
||||
)
|
||||
|
||||
func testCleanup() {
|
||||
root = newRoot()
|
||||
|
|
Loading…
Add table
Reference in a new issue