mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Resumable handles watch with revision zero
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
parent
0cd5999b78
commit
94a47a7cbd
@ -821,8 +821,6 @@ func TestValidateWatch(t *testing.T) {
|
||||
putPersistedEvent("b", "2", 3, true),
|
||||
putPersistedEvent("c", "3", 4, true),
|
||||
},
|
||||
// TODO: Should pass as watch with revision 0 might start from any revision.
|
||||
expectError: errBrokeResumable.Error(),
|
||||
},
|
||||
{
|
||||
name: "Reliable - missing last event - pass",
|
||||
|
@ -176,9 +176,11 @@ func validateReliable(lg *zap.Logger, events []model.PersistedEvent, report repo
|
||||
|
||||
func validateResumable(lg *zap.Logger, events []model.PersistedEvent, report report.ClientReport) (err error) {
|
||||
for _, op := range report.Watch {
|
||||
if op.Request.Revision == 0 {
|
||||
continue
|
||||
}
|
||||
index := 0
|
||||
revision := op.Request.Revision
|
||||
for index < len(events) && (events[index].Revision < revision || !events[index].Match(op.Request)) {
|
||||
for index < len(events) && (events[index].Revision < op.Request.Revision || !events[index].Match(op.Request)) {
|
||||
index++
|
||||
}
|
||||
if index == len(events) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user