Revisit docs about how could we "reconnect" when failure.
See also: https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/issues/73#issuecomment-888150328 Signed-off-by: Tao He <sighingnow@gmail.com>
This commit is contained in:
parent
3d4fa143e0
commit
891dc7bedf
|
|
@ -507,11 +507,12 @@ void wait_for_connection(Client &client) {
|
|||
void initialize_watcher(const std::string &endpoints,
|
||||
const std::string &prefix,
|
||||
std::function<void(Response)> callback,
|
||||
std::unique_ptr<etcd::Watcher> &watcher) {
|
||||
std::shared_ptr<etcd::Watcher> &watcher) {
|
||||
Client client(endpoints);
|
||||
wait_for_connection(client);
|
||||
watcher->reset(new etcd::Watcher(client, prefix, callback));
|
||||
watcher->Wait([endpoints, prefix, callback, &watcher](bool cancelled) {
|
||||
watcher->Wait([endpoints, prefix, callback,
|
||||
watcher_ref /* keep the shared_ptr alive */, &watcher](bool cancelled) {
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue