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 concurrent modification error when closing socket #824

Merged
merged 1 commit into from
May 5, 2024

Conversation

stnguyen90
Copy link
Contributor

What does this PR do?

Since subscription.close() modifies _subscriptions, we need to create a separate list to avoid concurrent modification error.

Closes appwrite/sdk-for-flutter#200

Test Plan

Manually tested and confirmed subscribing and unsubscribing still works:

image

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

Yes

Since subscription.close() modifies _subscriptions, we need to create a
separate list to avoid concurrent modification error.
@stnguyen90 stnguyen90 marked this pull request as ready for review May 4, 2024 02:01
@stnguyen90 stnguyen90 self-assigned this May 4, 2024
Copy link
Member

@lohanidamodar lohanidamodar left a comment

Choose a reason for hiding this comment

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

Wait will this also notify the subscriber when we make copy of the list do the subscriber still get notification?

@stnguyen90
Copy link
Contributor Author

Wait will this also notify the subscriber when we make copy of the list do the subscriber still get notification?

@lohanidamodar, dart doesn't make a copy on assignment; they all reference the same objects.

@lohanidamodar lohanidamodar merged commit a006788 into master May 5, 2024
34 checks passed
@lohanidamodar lohanidamodar deleted the fix-200-concurrent-modification branch May 5, 2024 01:15
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.

🐛 Bug Report: RealTime subscribe throws Concurrent modification during iteration: _Map len:0
3 participants