Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: registered LDStatusListeners are now sent updates that result from a call to LDClient.identify(...) #274

Merged

Conversation

tanderson-ld
Copy link
Contributor

@tanderson-ld tanderson-ld commented Jul 9, 2024

Requirements

  • I have added test coverage for new or changed functionality

  • I have followed the repository's pull request submission guidelines

  • I have validated my changes against all supported platform versions

Related issues

https://app.shortcut.com/launchdarkly/story/211876/android-sdk-connectioninformation-and-listeners-not-updated-correctly

Describe the solution you've provided

The issue was introduced in version 4.X and is has affected 2 major versions. The root of the issue is that from 3.x to 4.x, the code that sets the connection mode and kicks the last successful connection timestamp was moved out of the connectivity manager, so reconnects (which are handled inside the connectivity manager), were not handled. The fix is to adjust the code so that cconnection information / connection timestamps are kicked when the reconnect logic succeeds or fails.

Describe alternatives you've considered

Refactoring to match iOS's logic of emitting an offline event when reconnecting. This would more closely match 3.x. This was rejected as not having a good ratio of work required and risk involved. It also could introduce unexpected behavior for customers that implemented LDStatusListeners in version 4.x and 5.x.

@tanderson-ld tanderson-ld requested a review from a team July 9, 2024 15:10
@@ -76,8 +76,6 @@ class ConnectivityManager {
// source we're using, like "if there was an error, update the ConnectionInformation."
private class DataSourceUpdateSinkImpl implements DataSourceUpdateSink {
private final ContextDataManager contextDataManager;
private final AtomicReference<ConnectionMode> connectionMode = new AtomicReference<>(null);
private final AtomicReference<LDFailure> lastFailure = new AtomicReference<>(null);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: These pieces of data duplicated what was held in the ConnectionInformationState member of the ConnectivityManager, so removed duplication to reduce chance of being out of sync.

if (error == null) {
updateConnectionInfoForSuccess(newConnectionMode);
} else {
updateConnectionInfoForError(newConnectionMode, error);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Majority of the removed code has been moved into updateConnectionInfoForSuccess and updateConnectionInfoForError.

@tanderson-ld tanderson-ld merged commit a648213 into main Jul 10, 2024
7 checks passed
@tanderson-ld tanderson-ld deleted the ta/sc-211876/fixing-connection-information-update-bug branch July 10, 2024 18:07
tanderson-ld pushed a commit that referenced this pull request Jul 10, 2024
🤖 I have created a release *beep* *boop*
---


##
[5.3.1](5.3.0...5.3.1)
(2024-07-10)


### Bug Fixes

* registered LDStatusListeners are now sent updates that result from a
call to LDClient.identify(...)
([#274](#274))
([a648213](a648213))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants