Skip to content

LDClient.isInitialized doesn't evaluate to true immediately after LDClient.init() finishes with a timeout #284

@hikaritenchi

Description

@hikaritenchi

Is this a support request?
Shouldn't be, but I think this is either a bug or some documentation should be changed.

Describe the bug
Immediately after LDClient.init(a, conf, cont, 14) returns, I expect LDClient.isInitialized to return true, but it does not do so for a nontrivial amount of time, especially since I specified a nonzero timeout.

To reproduce

Timber.e("start: ${System.currentTimeMillis()}")
val client: LDClient = LDClient.init(application, ldConfig, context, 14)
Timber.e("before: ${System.currentTimeMillis()}")
Timber.e("init: ${client.isInitialized}")
while(!client.isInitialized) {}
Timber.e("after: ${System.currentTimeMillis()}")
Timber.e("client init: ${client.isInitialized}")

Expected behavior
I expect LDClient.isInitialized to return true immediately after LDClient.init() is called with a nonzero timeout.

Logs
2024-12-17 13:08:22.140 E start: 1734458902140
2024-12-17 13:08:22.142 E before: 1734458902141
2024-12-17 13:08:22.142 E client init: false
2024-12-17 13:08:22.441 E after: 1734458902440
2024-12-17 13:08:22.442 E client init: true

SDK version
5.5.0

Language version, developer tools
I think the only relevant information is Java 21 and Gradle 8.9. This was tested on the Android sample app.

OS/platform
Android 11

Additional context
If this isn't actually a bug, then I'd like to request some documentation updates because it's easy to confuse the fact that isInitialized shouldn't be true after init() finishes. I can imagine a scenario where passing 0 for the wait would cause this situation to happen, but I've indicated that I am willing to wait for init().

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