Skip to content

LD Init taking more time than its Timeout suggests #272

@efguydan

Description

@efguydan

Is this a support request?
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the code in this library. If you're not sure whether the problem you are having is specifically related to this library, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going here and clicking "submit a request", or by emailing [email protected].

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

Describe the bug
Hello. We are trying to update our LD Sdk from 3.6.0 to 5.3.0 but we have noticed a huge jump in the time it takes to initialize the SDK. Going above even the timeout we have indicated

Here is the code snippet of our init

private fun createConfig(): LDConfig {
        val mobileKey = "KEY_HERE"
        val secondaryMobileKeys: Map<String, String> = mutableMapOf(
            "secondKey" to "KEY_HERE",
        )
        return LDConfig.Builder()
            .mobileKey(mobileKey)
            .secondaryMobileKeys(secondaryMobileKeys)
            .evaluationReasons(true)
            .disableBackgroundUpdating(true)
            .build()
    }

fun initLaunchDarkly() {
        val time0 = System.currentTimeMillis()
        val future = LDClient.init(application, config, user.toLDContext(), 0)
        val time1 = System.currentTimeMillis()
        logE { "TimingTiming - ${time1 - time0}" }
}

The code above gives a time of 4813 ms

image

We were able to reproduce this down to version 4.0.0.

To reproduce
Included the SDK in our project and ran the app.
This happens on every install and the time does vary between 2 and 5 seconds

Expected behavior
The set timeout should be respected

SDK version
5.3.0

Language version, developer tools
Kotlin - 1.9.23

OS/platform
Android 14

Additional Context
This also happens when we use the deprecated init that returns a future.
future.get() respects the set timeout but LDClient.Init which Is expected to take negligible time sometime takes over 5 seconds

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions