Skip to content

fix: Prevent the data source status from changing after the client closes - #346

Draft
jsonbailey wants to merge 4 commits into
mainfrom
jb/sdk-3321/status-latch
Draft

jsonbailey wants to merge 4 commits into
mainfrom
jb/sdk-3321/status-latch

Conversation

@jsonbailey

@jsonbailey jsonbailey commented Oct 15, 2026 •

Copy link
Copy Markdown

Summary

After close(), work that started before the close can still finish. For example, a put that is still being stored calls setValid() when it completes. That changed the data source status and the last error on a client that was already closed.

  • After the data source manager stops, in-flight data source work does not change the data source status and does not complete a pending identify.
  • The guard is in DataSourceManager and DataSourceEventHandler, the code that sends status updates. DataSourceStatusManager is unchanged.
  • Tests hold persistence open across stop() for put, FDv2 payload, patch and delete (success and failure), and for a queued status event.

@@ -230,6 +241,7 @@ final class DataSourceManager {

void stop() {

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: same result as the other SDKs (no status change after close), different place. Android checks closed in its data sources, which works because they apply payloads and set status synchronously. Here the data source only emits events, and this class applies them asynchronously after persistence, so the guard has to be here. iOS has no status manager. A status-value latch (the server SDK approach) does not fit, because close sets no terminal state and the status manager outlives identify and mode changes.

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