Skip to content

LDClient identify completion handler is never invoked when there are network connectivity issues #264

Description

@SD10

Describe the bug
The identify method of LDClient never invokes its completion block parameter in situations of poor connectivity that cause the underlying network requests to fail

To reproduce

  • Add LaunchDarkly 5.4.5 to a new project
  • Use the LDClient.identify method and provide a completion block
  • Simulate 100% loss of network connection
  • Run the project
let user = LDUser(key: "1")
LDClient.get().identify(user) {
    print("Call me maybe")
}

Expected behavior
The identify method should call its completion handler after a specified timeout and cause the print to be executed.

Logs

  • The console shows the underlying requests failing and the LDClient trying to reconnect infinitely
  • The text from the print statement is never logged

SDK version
5.4.5

Language version, developer tools
Xcode 13, Swift 5

OS/platform
iOS 15

Additional context
The LDClient documentation states:

A completion may be passed to the identify method to allow a client app to know when fresh flag values for the new user are ready.

and

completion: Closure called when the embedded setOnlineIdentify call completes, subject to throttling delays. (Optional)

This makes it dangerous to block user progression in the application using the identify method since it will never timeout in the case of network connectivity issues or issues with the Launch Darkly service.

  1. Adding a timeout parameter to the identify method to would help mitigate this issue
  2. Adding additional context to the completion handler such as a boolean flag indicating whether the completion handler is being invoked in the scenario of success or failure would be very useful for error handling as well

Related issues: #211, #209

Thank you 🙏

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