rust-server-sdk icon indicating copy to clipboard operation
rust-server-sdk copied to clipboard

Warning "We recommend blocking no longer than 60 seconds" without an explanation

Open samscott89 opened this issue 1 year ago • 1 comments

Small nit/documentation question.

We set wait_for_initialization to 120s as a conservative estimate of how long to wait for the client to connect. In production we've observed init taking as long as 25s, so this seemed like a reasonable time. We're now getting warnings from the client.

Two minor requests: (a) It would have been nice for this to be documented in the API (b) Can you expand on why we shouldn't wait for longer? For us LD is on the critical path and if we cannot initialize we need to fallback to an offline mode which we would rather avoid.

For completeness, repro is:

let initialized = client.wait_for_initialization(std::time::Duration::from_secs(120)).await;

samscott89 avatar Jul 26 '24 14:07 samscott89

Thank you for providing this feedback!

(a) It would have been nice for this to be documented in the API

I can raise this issue and work to get some clarification in the documentation. Can you tell me where you think it would be best for us to document this behavior? Would you expect something in the rust docs, the changelog, or on https://docs.launchdarkly.com?

(b) Can you expand on why we shouldn't wait for longer? For us LD is on the critical path and if we cannot initialize we need to fallback to an offline mode which we would rather avoid.

LaunchDarkly SDKs are designed to return evaluation results even if a connection cannot be established with the upstream APIs. During that time, the SDK will return the default_value parameter provided at the variation callsites. Meanwhile, the SDK will continue attempting to connect with LaunchDarkly to finish receiving the payload.

This is why we don't recommend completely blocking your application's ability to serve requests just because we can't connected upstream. You can still serve requests and use the default value.

But you certainly CAN wait longer than the prescribed 60 seconds, as this is just a recommendation from us.

keelerm84 avatar Jul 29 '24 15:07 keelerm84

Closing due to inactivity.

keelerm84 avatar Mar 21 '25 15:03 keelerm84