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-376/Add checks to prevent re-initialization of the connectivitywatcher #387

Merged
merged 1 commit into from
Apr 8, 2022

Conversation

gpanshu
Copy link
Contributor

@gpanshu gpanshu commented Apr 5, 2022

Add checks to prevent re-initialization of the connectivityWatcher and unregistering before registering the same watcher to prevent too manyrequests to networkcallback registeration

*Issue #376

Description of changes:

  • Added check for initialized connectivityWatcher and if already initialized, unregister the current listener before re-registering.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…d unregistering before registering the same watcher to prevent too manyrequests to networkcallback registeration
@gpanshu gpanshu self-assigned this Apr 5, 2022
@gpanshu gpanshu linked an issue Apr 5, 2022 that may be closed by this pull request
@gpanshu gpanshu merged commit e7c4c3c into main Apr 8, 2022
@gpanshu gpanshu deleted the 376-toomanyrequestsexception branch April 8, 2022 15:51
@tbartley
Copy link

Not sure how the change in aws-android-sdk-appsync/src/main/java/com/amazonaws/mobileconnectors/appsync/AppSyncOfflineMutationManager.java is intended to work. Since it's in the constructor, this.connectivityWatcher will always be null and so the unregister will never be called.

We see this issue more in our testing where we have a lot of instances of this class each of which has registered a watcher and so we hit the limit when we have a certain number of tests. It would be very useful to have a method on AWSAppSyncClient that would call down in to AppSyncOfflineMutationManager to unregister the callback. We could then call this on test teardown.

levansang026 pushed a commit to notabasement/aws-mobile-appsync-sdk-android that referenced this pull request Nov 19, 2022
…d unregistering before registering the same watcher to prevent too manyrequests to networkcallback registeration (awslabs#387)
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.

android.net.ConnectivityManager$TooManyRequestsException
4 participants