Ubuntu Pastebin

Paste from fwereade at Fri, 15 Apr 2016 15:08:13 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/api/watcher/watcher.go b/api/watcher/watcher.go
index 9cea159..33b9a9f 100644
--- a/api/watcher/watcher.go
+++ b/api/watcher/watcher.go
@@ -72,6 +72,7 @@ func (w *commonWatcher) commonLoop() {
 	defer close(w.in)
 	var wg sync.WaitGroup
 	wg.Add(1)
+	defer wg.Wait()
 	go func() {
 		// When the watcher has been stopped, we send a Stop request
 		// to the server, which will remove the watcher and return a
@@ -118,7 +119,6 @@ func (w *commonWatcher) commonLoop() {
 			}
 		}
 	}()
-	wg.Wait()
 }
 
 // Kill is part of the worker.Worker interface.
Download as text