summaryrefslogtreecommitdiff
path: root/worker_watcher/container/channel/vec.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker_watcher/container/channel/vec.go')
-rw-r--r--worker_watcher/container/channel/vec.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/worker_watcher/container/channel/vec.go b/worker_watcher/container/channel/vec.go
index c0c27575..65c2066e 100644
--- a/worker_watcher/container/channel/vec.go
+++ b/worker_watcher/container/channel/vec.go
@@ -98,15 +98,16 @@ func (v *Vec) Push(w worker.BaseProcess) {
func (v *Vec) Remove(_ int64) {}
func (v *Vec) Pop(ctx context.Context) (worker.BaseProcess, error) {
- /*
- if *addr == old {
- *addr = new
- return true
- }
- */
-
if atomic.LoadUint64(&v.destroy) == 1 {
- return nil, errors.E(errors.WatcherStopped)
+ // drain channel
+ for {
+ select {
+ case <-v.workers:
+ continue
+ default:
+ return nil, errors.E(errors.WatcherStopped)
+ }
+ }
}
// used only for the TTL-ed workers