Skip to content
Snippets Groups Projects
Commit 8fa22d25 authored by ale's avatar ale
Browse files

must use WatchAll() on config tree

parent 357974cb
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,7 @@ func (w *ConfigSyncer) syncer() { ...@@ -97,6 +97,7 @@ func (w *ConfigSyncer) syncer() {
for { for {
select { select {
case response := <-w.rch: case response := <-w.rch:
if response.Action == "delete" { if response.Action == "delete" {
mountName := keyToMount(response.Key) mountName := keyToMount(response.Key)
log.Printf("deleted mount %s", mountName) log.Printf("deleted mount %s", mountName)
...@@ -169,7 +170,7 @@ func (w *ConfigSyncer) Run() { ...@@ -169,7 +170,7 @@ func (w *ConfigSyncer) Run() {
for { for {
curIndex := w.index + 1 curIndex := w.index + 1
log.Printf("starting watcher at index %d", curIndex) 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 { if err == etcd.ErrWatchStoppedByUser {
return return
} else if err != nil { } else if err != nil {
...@@ -261,10 +262,15 @@ func (rc *RadioNode) Run() { ...@@ -261,10 +262,15 @@ func (rc *RadioNode) Run() {
// Start the masterelection runner. // Start the masterelection runner.
go rc.me.Run() 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") log.Printf("starting icecast updater")
for { for {
select { select {
case <-rc.upch: case <-rc.upch:
log.Printf("reloading icecast config")
if err := rc.icecast.Update(rc.Config, rc.me.IsMaster(), rc.me.GetMasterAddr()); err != nil { if err := rc.icecast.Update(rc.Config, rc.me.IsMaster(), rc.me.GetMasterAddr()); err != nil {
log.Printf("Update(): %s", err) log.Printf("Update(): %s", err)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment