-
Notifications
You must be signed in to change notification settings - Fork 39
restart go engine on network change #97
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
base: main
Are you sure you want to change the base?
Conversation
From HashSet to ConcurrentHashMap's KeySet, which is thread-safe.
When subscribing to ConcreteNetworkAvailabilityListener
The availableNetworkTypes HashMap is accessed from network callback threads without synchronization
Restart runnable is used as a debouncing mechanism to prevent concurrent restarts Timeout callback is to reset the isRestartInProgress flag's value if the engine takes too long to restart
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.
Can we run from CI the Android test?
| } | ||
|
|
||
| @Override | ||
| public void onNetworkAvailable(@Constants.NetworkType int networkType) { |
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.
Consider another transport types. It would be important on Android TV or IoT devices.
TRANSPORT_ETHERNET, TRANSPORT_SATELLITE, etc...
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.
We'll skip those for now as discussed.
Now it disposes of network listener components before stopping engineRunner
This PR adds a mechanism that tracks available network capabilities and resets the go engine when the connection changes.
Scenarios:
WiFi is lost -> Cellular is available
Cellular is available -> WiFi is available