Watch should start from next index when getting the initial state
Also, the fake response we return should have an Action that is appropriate for the operation.
This commit is contained in:
@@ -419,11 +419,11 @@ func etcdGetInitialWatchState(client EtcdGetSet, key string, recursive bool, inc
|
||||
return
|
||||
}
|
||||
if index, ok := etcdErrorIndex(err); ok {
|
||||
resourceVersion = index
|
||||
resourceVersion = index + 1
|
||||
}
|
||||
return
|
||||
}
|
||||
resourceVersion = resp.EtcdIndex
|
||||
resourceVersion = resp.EtcdIndex + 1
|
||||
convertRecursiveResponse(resp.Node, resp, incoming)
|
||||
return
|
||||
}
|
||||
@@ -438,6 +438,11 @@ func convertRecursiveResponse(node *etcd.Node, response *etcd.Response, incoming
|
||||
return
|
||||
}
|
||||
copied := *response
|
||||
if node.ModifiedIndex == node.CreatedIndex {
|
||||
copied.Action = "create"
|
||||
} else {
|
||||
copied.Action = "set"
|
||||
}
|
||||
copied.Node = node
|
||||
incoming <- &copied
|
||||
}
|
||||
|
Reference in New Issue
Block a user