From 9d49d35090e8fede7bdf92570ca5706d5ffd33dc Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 29 Mar 2016 09:28:53 -0700 Subject: [PATCH] client: doc that client is thread-safe --- client/doc.go | 2 ++ clientv3/doc.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/client/doc.go b/client/doc.go index 70111cace..36c3d8c9d 100644 --- a/client/doc.go +++ b/client/doc.go @@ -34,6 +34,8 @@ Create a Config and exchange it for a Client: // handle error } +Clients are safe for concurrent use by multiple goroutines. + Create a KeysAPI using the Client, then use it to interact with etcd: kAPI := client.NewKeysAPI(c) diff --git a/clientv3/doc.go b/clientv3/doc.go index b1cecf726..641dea351 100644 --- a/clientv3/doc.go +++ b/clientv3/doc.go @@ -38,6 +38,9 @@ // } // // use the response // +// The Client has internal state (watchers and leases), so Clients should be reused instead of created as needed. +// Clients are safe for concurrent use by multiple goroutines. +// // etcd client returns 2 types of errors: // // 1. context error: canceled or deadline exceeded.