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

feat: avoid lock and add check when complete #198

Merged
merged 10 commits into from
Jan 15, 2025
Merged

Conversation

mattisonchao
Copy link
Member

Motivation

This PR will improve the logic to avoid unnecessary locks and add a check when the stream is complete.

Modification

  • lock-free first when getting the stream.
  • Add check when the stream complete

}
writeStreams.remove(shardId, wrapper);
}
return wrapper;

Choose a reason for hiding this comment

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

Will it return null after the second try?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since we have computIfAbsent. that should impossible.

@mattisonchao mattisonchao merged commit 8f317e8 into main Jan 15, 2025
1 check passed
@mattisonchao mattisonchao deleted the improve.write.stream branch January 15, 2025 10:21
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.

3 participants