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() {
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)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment