diff --git a/coordination/etcdtest/fake_etcd.go b/coordination/etcdtest/fake_etcd.go index f163c116f2c33aba783fe1dddce2dd9ef5f23c97..a14891af42103edabbe0b11f5621ed664ad3cdc1 100644 --- a/coordination/etcdtest/fake_etcd.go +++ b/coordination/etcdtest/fake_etcd.go @@ -164,6 +164,7 @@ func (s *FakeEtcdClient) Get(key string, recursive, boh bool) (*etcd.Response, e EtcdIndex: s.index, } var nodes []*etcd.Node + var modifiedIndex uint64 key = strings.TrimSuffix(key, "/") keyDirPfx := key + "/" for path, datum := range s.data { @@ -174,6 +175,9 @@ func (s *FakeEtcdClient) Get(key string, recursive, boh bool) (*etcd.Response, e Value: datum.value, ModifiedIndex: datum.index, }) + if datum.index > modifiedIndex { + modifiedIndex = datum.index + } } } switch { @@ -183,9 +187,10 @@ func (s *FakeEtcdClient) Get(key string, recursive, boh bool) (*etcd.Response, e resp.Node = nodes[0] default: resp.Node = &etcd.Node{ - Key: key, - Dir: true, - Nodes: nodes, + Key: key, + Dir: true, + Nodes: nodes, + ModifiedIndex: modifiedIndex, } } return resp, nil @@ -225,6 +230,7 @@ func (s *FakeEtcdClient) Watch(key string, index uint64, recursive bool, respch // First scan the data to check for changes >= index. s.lock.Lock() var nodes []*etcd.Node + var modifiedIndex uint64 for k, d := range s.data { if strings.HasPrefix(k, key) && d.index >= index { nodes = append(nodes, &etcd.Node{ @@ -232,6 +238,9 @@ func (s *FakeEtcdClient) Watch(key string, index uint64, recursive bool, respch Value: d.value, ModifiedIndex: d.index, }) + if d.index > modifiedIndex { + modifiedIndex = d.index + } } } if len(nodes) > 0 { @@ -239,9 +248,10 @@ func (s *FakeEtcdClient) Watch(key string, index uint64, recursive bool, respch resp := &etcd.Response{ Action: "update", Node: &etcd.Node{ - Key: key, - Dir: true, - Nodes: nodes, + Key: key, + Dir: true, + Nodes: nodes, + ModifiedIndex: modifiedIndex, }, EtcdIndex: s.index, } diff --git a/coordination/presence/presence.go b/coordination/presence/presence.go index 5f6192918d0f0c7d58a2ca2c292f710a9dd1836e..c99e54cb5e8c423edd9249d4222906c9d6dfd1b5 100644 --- a/coordination/presence/presence.go +++ b/coordination/presence/presence.go @@ -124,6 +124,7 @@ func (p *Presence) run() { if t.Sub(lastUpdate) > ttl { doinit = true } + continue } } lastUpdate = t diff --git a/coordination/watcher/watcher.go b/coordination/watcher/watcher.go index 3770edc9a6b496e2de13ec686dc7a62dfbfd116d..58543d04dde23c754f882097080c46bfb36012f4 100644 --- a/coordination/watcher/watcher.go +++ b/coordination/watcher/watcher.go @@ -138,7 +138,7 @@ func (w *Watcher) watcher(c chan<- *etcd.Response) { continue } - index = resp.EtcdIndex + index = resp.Node.ModifiedIndex c <- resp } diff --git a/debian/changelog b/debian/changelog index 98079a577631b5c156a6b0a08c2774f05bc48dda..2d41ff8232078e1db258e3e6deba852396dff4b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +autoradio (0.6.1) unstable; urgency=medium + + * Rebuilt with Go 1.5.1. + * Fixes to the presence library. + + -- ale <ale@incal.net> Thu, 20 Aug 2015 08:38:48 +0100 + autoradio (0.6) unstable; urgency=medium * Etcd 2.0 compatibility.