File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -154,17 +154,18 @@ func (w *watcher) Start(ctx context.Context, r *etcdserverpb.WatchCreateRequest)
154154 inner = false
155155 }
156156 }
157+ // get max revision from collected events
158+ if len (events ) > 0 {
159+ revision = events [len (events )- 1 ].KV .ModRevision
160+ }
157161 case revision = <- progressCh :
158162 // have been requested to send progress with no events
159163 }
160164
161- // get max revision from collected events
162- if len (events ) > 0 {
163- revision = events [len (events )- 1 ].KV .ModRevision
164- }
165-
166- // send response. note that there are no events if this is a progress response.
167- if len (events ) == 0 || revision >= startRevision {
165+ // send response. note that there are no events if this is a progress response -
166+ // but revision 0 is also sent on the progress channel to check if this
167+ // reader has synced or not, so we must not send with revision 0.
168+ if revision != 0 && (len (events ) == 0 || revision >= startRevision ) {
168169 wr := & etcdserverpb.WatchResponse {
169170 Header : txnHeader (revision ),
170171 WatchId : id ,
You can’t perform that action at this time.
0 commit comments