lib/ldclient-rb/impl/integrations/consul_impl.rb in launchdarkly-server-sdk-7.1.0 vs lib/ldclient-rb/impl/integrations/consul_impl.rb in launchdarkly-server-sdk-7.2.0
- old
+ new
@@ -117,9 +117,21 @@
rescue Diplomat::KeyNotFound
false
end
end
+ def available?
+ # Most implementations use the initialized_internal? method as a
+ # proxy for this check. However, since `initialized_internal?`
+ # catches a KeyNotFound exception, and that exception can be raised
+ # when the server goes away, we have to modify our behavior
+ # slightly.
+ Diplomat::Kv.get(inited_key, {}, :return, :return)
+ true
+ rescue
+ false
+ end
+
def stop
# There's no Consul client instance to dispose of
end
private