pub async fn sync_launchdarkly_to_configset<F>(
set: ConfigSet,
build_info: &'static BuildInfo,
ctx_builder: F,
launchdarkly_sdk_key: Option<&str>,
config_sync_timeout: Duration,
config_sync_loop_interval: Option<Duration>,
on_update: impl Fn(&ConfigUpdates, &ConfigSet) + Send + 'static,
) -> Result<(), Error>
Expand description
Start a background task that syncs to a ConfigSet from LaunchDarkly. ctx_builder
can be used
to add additional LD contexts. A build
context is added automatically. Returns Ok
after the
LD client has been initialized and an initial sync completed. If the initialization takes longer
than config_sync_timeout
, an error is returned.
A successful initialization can take up to config_sync_timeout
, preventing the calling service
from starting for possibly up to that duration. Its value should be chosen based on the needs of
the service in the case that LaunchDarkly is down.
If the caller chooses to continue if this function returns an error, the ConfigSet will retain its default values. Those should be chosen with this risk in mind.