Browse Source

clientv3: document possible memory pile-up in Watch

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 8 years ago
parent
commit
31c2d4b0a2
1 changed files with 2 additions and 0 deletions
  1. 2 0
      clientv3/watch.go

+ 2 - 0
clientv3/watch.go

@@ -48,6 +48,8 @@ type Watcher interface {
 	// client will post a compacted error watch response, and the channel will close.
 	// client will post a compacted error watch response, and the channel will close.
 	// If the context "ctx" is canceled or timed out, returned "WatchChan" is closed,
 	// If the context "ctx" is canceled or timed out, returned "WatchChan" is closed,
 	// and "WatchResponse" from this closed channel has zero events and nil "Err()".
 	// and "WatchResponse" from this closed channel has zero events and nil "Err()".
+	// The context "ctx" MUST be canceled, as soon as watcher is no longer being used,
+	// to release the associated resources.
 	// If the context is "context.Background/TODO", returned "WatchChan" will not be closed
 	// If the context is "context.Background/TODO", returned "WatchChan" will not be closed
 	// and wait until events happen, except when server returns a non-recoverable error.
 	// and wait until events happen, except when server returns a non-recoverable error.
 	// For example, when context passed with "WithRequireLeader" and the connected server
 	// For example, when context passed with "WithRequireLeader" and the connected server