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

ConnectionInformation doesn't get updated after identifying to a different context #226

Closed
anawu2006 opened this issue Aug 7, 2023 · 5 comments

Comments

@anawu2006
Copy link

Is this a support request?
No

Describe the bug
In SDK 3.6.0, LDClient.get().connectionInformation will get updated with a new lastSuccessfulConnection value after identifying to a different user, but not in 5.0.0.

To reproduce

  1. init LDClient with ldContext1 and register a LDStatusListener
    LDClient.init(context, config, ldContext1, 3)
    LDClient.get().registerStatusListener(statusListener)
    
  2. switch to ldContext2:
    LDClient.get().identify(ldContext2)
    
  3. LDClient.get().connectionInformation doesn't get updated and LDStatusListener.onConnectionModeChanged doesn't get triggered.

Expected behavior
LDClient.get().connectionInformation should be updated with a new lastSuccessfulConnection value and LDStatusListener.onConnectionModeChanged` should be triggered.

Logs
None.

SDK version
5.0.0

Language version, developer tools
Android Kotlin, API 34

OS/platform
Android 13

Additional context
I have checked the source code of ConnectivityManager.setStatusand noticed that LastSuccessfulConnection value won't be updated if the ConnectionMode doesn't change. I think the connection information should be updated in this case given the LDContext changed. But feel free to close this out if you don't think so.

@tanderson-ld
Copy link
Contributor

Hi @anawu2006 , thank you for reporting this. We believe this bug has been in the code base since 4.x and has been overlooked. We have filed this internally as 211876.

Could you tell us a bit about how you are using the listener in your code base and the impact of this bug on your application? This will help us prioritize it against other issues. Thank you for taking the time to report!

@anawu2006
Copy link
Author

anawu2006 commented Aug 8, 2023

@tanderson-ld you are correct, this bug exists in 4.x as well.

In our app, having a new successful connection to LD server is one of the conditions when switching users/contexts. So after identifying, we wait until LDStatusListener.onConnectionModeChanged gets triggered with a new connectionInformation.lastSuccessfulConnection value.

With this issue, we are not able to switch users/contexts successfully. Any other suggested solutions to identify a new successful connection to server after identifying? Thanks.

@tanderson-ld
Copy link
Contributor

Sorry for the delay @anawu2006 . Could you try setOffline(), identify, then setOnline()? I think that is enough to get the connection manager to change states.

@anawu2006
Copy link
Author

@tanderson-ld no worries and that is exactly what I had put up to bypass this issue. Thanks.

@tanderson-ld
Copy link
Contributor

@anawu2006 , this issue should now be fixed in version 5.3.1 which was just released. Please be aware that the SDK may send multiple updates in quick succession with just the last connection timestamp updated.

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

No branches or pull requests

2 participants