diff --git a/node/node.go b/node/node.go index 351f152042d2701b467c1452b1a2b67c1eab3e3b..e4cd94886941030b04f757b362db782bedf864fc 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) }