Skip to content

fix: Complete a pending identify or start with an error when the client closes - #347

Draft
jsonbailey wants to merge 1 commit into
mainfrom
jb/sdk-3328/close-identify
Draft

jsonbailey wants to merge 1 commit into
mainfrom
jb/sdk-3328/close-identify

Conversation

@jsonbailey

Copy link
Copy Markdown

Summary

If close() was called while identify() or start() was still waiting for flag data, the returned future never completed. Code that awaited it with no timeout waited forever.

  • When the client closes, a pending identify() completes with IdentifyError ("The client was closed before the identify completed."), and a pending start() completes with false.
  • Identifies and starts that have already completed are not affected. The start identify still can never be superseded.
  • The IdentifyError, close(), identify() and start() docs describe the close behavior.

///
/// A pending [start] completes with false, and a pending [identify]
/// completes with [IdentifyError].
Future<void> close() async {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-SDK note, for team discussion: iOS and Android both leave a pending identify waiting after close. On iOS, internalClose goes offline without calling the completion. On Android, ConnectivityManager.shutDown stops the data source with a no-op callback. Flutter completes it with IdentifyError("The client was closed before the identify completed."), so that code awaiting identify without a timeout does not wait forever.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant