From 8fa22d25f2015bceae36c87678ec490cd0021071 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Fri, 15 Nov 2013 23:35:08 +0000
Subject: [PATCH] must use WatchAll() on config tree

---
 node/node.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/node/node.go b/node/node.go
index 351f1520..e4cd9488 100644
--- a/node/node.go
+++ b/node/node.go
@@ -97,6 +97,7 @@ func (w *ConfigSyncer) syncer() {
 	for {
 		select {
 		case response := <-w.rch:
+
 			if response.Action == "delete" {
 				mountName := keyToMount(response.Key)
 				log.Printf("deleted mount %s", mountName)
@@ -169,7 +170,7 @@ func (w *ConfigSyncer) Run() {
 		for {
 			curIndex := w.index + 1
 			log.Printf("starting watcher at index %d", curIndex)
-			_, err := w.client.Watch(radioai.MountPrefix, curIndex, w.rch, w.stop)
+			_, err := w.client.WatchAll(radioai.MountPrefix, curIndex, w.rch, w.stop)
 			if err == etcd.ErrWatchStoppedByUser {
 				return
 			} else if err != nil {
@@ -261,10 +262,15 @@ func (rc *RadioNode) Run() {
 	// Start the masterelection runner.
 	go rc.me.Run()
 
+	// Wait an instant to give a chance to the other services to
+	// initialize.
+	time.Sleep(200 * time.Millisecond)
+
 	log.Printf("starting icecast updater")
 	for {
 		select {
 		case <-rc.upch:
+			log.Printf("reloading icecast config")
 			if err := rc.icecast.Update(rc.Config, rc.me.IsMaster(), rc.me.GetMasterAddr()); err != nil {
 				log.Printf("Update(): %s", err)
 			}
-- 
GitLab