Cleanup related to context refactor (#9988)

Этот коммит содержится в:
Christopher Speller
2018-12-17 08:51:46 -08:00
коммит произвёл GitHub
родитель 829f183bb0
Коммит 8429add371
55 изменённых файлов: 1027 добавлений и 949 удалений

Просмотреть файл

@@ -20,15 +20,15 @@ type Watcher struct {
srv *JobServer
workers *Workers
stop chan bool
stopped chan bool
stop chan struct{}
stopped chan struct{}
pollingInterval int
}
func (srv *JobServer) MakeWatcher(workers *Workers, pollingInterval int) *Watcher {
return &Watcher{
stop: make(chan bool, 1),
stopped: make(chan bool, 1),
stop: make(chan struct{}),
stopped: make(chan struct{}),
pollingInterval: pollingInterval,
workers: workers,
srv: srv,
@@ -45,7 +45,7 @@ func (watcher *Watcher) Start() {
defer func() {
mlog.Debug("Watcher Finished")
watcher.stopped <- true
close(watcher.stopped)
}()
for {
@@ -61,7 +61,7 @@ func (watcher *Watcher) Start() {
func (watcher *Watcher) Stop() {
mlog.Debug("Watcher Stopping")
watcher.stop <- true
close(watcher.stop)
<-watcher.stopped
}