Skip to content

feat: avoid lock and add check when complete#198

Merged
mattisonchao merged 10 commits intomainfrom
improve.write.stream
Jan 15, 2025
Merged

feat: avoid lock and add check when complete#198
mattisonchao merged 10 commits intomainfrom
improve.write.stream

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;
Copy link
Collaborator

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