-
Notifications
You must be signed in to change notification settings - Fork 23
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
fix: registered LDStatusListeners are now sent updates that result from a call to LDClient.identify(...) #274
Conversation
…om a call to LDClient.identify(...).
@@ -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); |
There was a problem hiding this comment.
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); | ||
} |
There was a problem hiding this comment.
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
.
🤖 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>
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.