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: Thread safe subscription watcher cancel #523

Merged
merged 2 commits into from
Mar 7, 2022
Merged

Conversation

lawmicha
Copy link
Contributor

@lawmicha lawmicha commented Feb 25, 2022

Issue #, if available:

Description of changes:
If a connection is cancelled immediately after a subscribe, there may be a crash when accessing connection

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

@lawmicha lawmicha marked this pull request as draft February 25, 2022 20:57
@lawmicha lawmicha marked this pull request as ready for review February 28, 2022 18:55
Comment on lines 182 to 187
if !self.isCancelled {
if self.cancellationSource == .none {
self.cancellationSource = .user
}
self.performCleanUpTasksOnCancel()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we use a guard and an early return instead of nested ifs?

@lawmicha lawmicha merged commit b052e40 into main Mar 7, 2022
@lawmicha lawmicha deleted the fix/watcher-cancel branch March 7, 2022 16:25
karim-alweheshy pushed a commit to chocoapp/aws-mobile-appsync-sdk-ios that referenced this pull request Mar 24, 2022
* fix: Thread safe subscription watcher cancel

* use guard
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