Explorar o código

Use ModifiedIndex and not EtcdIndex for watches

When watch returns, it's ModifiedIndex that contains
the index of the returned event. So its incremented value
should be used on next watch.

Fixes #48
Eugene Yakubovich %!s(int64=10) %!d(string=hai) anos
pai
achega
1166391b8f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      subnet/subnet.go

+ 1 - 1
subnet/subnet.go

@@ -359,7 +359,7 @@ func (sm *SubnetManager) WatchLeases(receiver chan EventBatch, cancel chan bool)
 }
 }
 
 
 func (sm *SubnetManager) parseSubnetWatchResponse(resp *etcd.Response) (batch *EventBatch, err error) {
 func (sm *SubnetManager) parseSubnetWatchResponse(resp *etcd.Response) (batch *EventBatch, err error) {
-	sm.lastIndex = resp.EtcdIndex
+	sm.lastIndex = resp.Node.ModifiedIndex
 
 
 	sn, err := parseSubnetKey(resp.Node.Key)
 	sn, err := parseSubnetKey(resp.Node.Key)
 	if err != nil {
 	if err != nil {