Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clientv3: cancel watches proactively on client context cancellation
Currently, watch cancel requests are only sent to the server after a message comes through on a watch where the client has cancelled. This means that cancelled watches that don't receive any new messages are never cancelled; they persist for the lifetime of the client stream. This has negative connotations for locking applications where a watch may observe a key which might never change again after cancellation, leading to many accumulating watches on the server. By cancelling proactively, in most cases we simply move the cancel request to happen earlier, and additionally we solve the case where the cancel request would never be sent. Fixes etcd-io#9416 Heavy inspiration drawn from the solutions proposed there.
- Loading branch information