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 presenceEventQueue Iteration Issues in publishPresenceEvents() #165

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

7hong13
Copy link
Contributor

@7hong13 7hong13 commented Apr 4, 2024

What this PR does / why we need it?

The presenceEventQueue iteration in publishPresenceEvents() faced several issues:

  • Using listIterator() resulted in a ConcurrentModificationException due to the possibility of new events being added to the queue during iteration.
  • Copying the queue for iteration caused already processed events to be republished asynchronously by publishPresenceEvent().

This PR resolves these issues by enforcing that new events can only be added to the presenceEventQueue right before iteration begins. This approach prevents ConcurrentModificationException without the need for queue copying, addressing the problems.

Any background context you want to provide?

What are the relevant tickets?

Fixes #

Checklist

  • Added relevant tests or not required
  • Didn't break anything

@7hong13 7hong13 self-assigned this Apr 4, 2024
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 54.34783% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 79.40%. Comparing base (8c2e63f) to head (4aa9a04).

❗ Current head 4aa9a04 differs from pull request most recent head b44017c. Consider uploading reports for the commit b44017c to get more accurate results

Files Patch % Lines
...ie/src/main/kotlin/dev/yorkie/document/Document.kt 55.81% 13 Missing and 6 partials ⚠️
yorkie/src/main/kotlin/dev/yorkie/core/Client.kt 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           main     #165       +/-   ##
=========================================
+ Coverage      0   79.40%   +79.40%     
=========================================
  Files         0       63       +63     
  Lines         0     3889     +3889     
  Branches      0      610      +610     
=========================================
+ Hits          0     3088     +3088     
- Misses        0      474      +474     
- Partials      0      327      +327     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@7hong13 7hong13 changed the title refactor presence event handling Fix presenceEventQueue Iteration Issues in publishPresenceEvents() Apr 4, 2024
@7hong13 7hong13 requested a review from skhugh April 4, 2024 06:57
@7hong13 7hong13 marked this pull request as ready for review April 4, 2024 06:57
@7hong13 7hong13 merged commit 7e66ba0 into main Apr 11, 2024
5 of 6 checks passed
@7hong13 7hong13 deleted the presence branch April 11, 2024 07:09
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