Merge pull request #6009 from heyitsanthony/fix-progress-notify

v3rpc: don't elide next progress notification on progress notification
This commit is contained in:
Anthony Romano 2016-07-20 13:46:11 -07:00 committed by GitHub
commit 15aa64eb3c
3 changed files with 4 additions and 3 deletions

View File

@ -487,7 +487,7 @@ func testWatchWithProgressNotify(t *testing.T, watchOnPut bool) {
} else if len(resp.Events) != 0 { // wait for notification otherwise } else if len(resp.Events) != 0 { // wait for notification otherwise
t.Fatalf("expected no events, but got %+v", resp.Events) t.Fatalf("expected no events, but got %+v", resp.Events)
} }
case <-time.After(2 * pi): case <-time.After(time.Duration(1.5 * float64(pi))):
t.Fatalf("watch response expected in %v, but timed out", pi) t.Fatalf("watch response expected in %v, but timed out", pi)
} }
} }

View File

@ -295,7 +295,8 @@ func (sws *serverWatchStream) sendLoop() {
} }
sws.mu.Lock() sws.mu.Lock()
if _, ok := sws.progress[wresp.WatchID]; ok { if len(evs) > 0 && sws.progress[wresp.WatchID] {
// elide next progress update if sent a key update
sws.progress[wresp.WatchID] = false sws.progress[wresp.WatchID] = false
} }
sws.mu.Unlock() sws.mu.Unlock()

View File

@ -971,7 +971,7 @@ func TestWatchWithProgressNotify(t *testing.T) {
} }
// no more notification // no more notification
rok, resp := waitResponse(wStream, testInterval+time.Second) rok, resp := waitResponse(wStream, time.Second)
if !rok { if !rok {
t.Errorf("unexpected pb.WatchResponse is received %+v", resp) t.Errorf("unexpected pb.WatchResponse is received %+v", resp)
} }