If couchbase server is down at the time of first lcb_connect call then libcouchbase will not automatically reconnect.
Right now I use workaround, by issuing another call to lcb_connect after some time (when server is possibly back again). It helps, but there are problems:
-
No clear way to know if manual reconnect should be performed. Using configuration callback helps - if we get it called back then libcouchbase will reconnect automatically.
-
Memory leak when using libev plugin. instance->event is not destroyed and being overwritten on every lcb_connect call. The only way seem to be to destroy lcb_t instance, but it’s not very convenient.
What is the right way to manage reconnects if initial connection have failed?