Conversation
mpetrunic
previously approved these changes
Feb 26, 2026
|
Go Test coverage is 53.6 %\ ✨ ✨ ✨ |
There was a problem hiding this comment.
Pull request overview
This PR changes libp2p stream management to reuse streams across session IDs, and addresses a coordinator mutex usage issue when checking pending processes.
Changes:
- Update
Coordinator.Executeto readpendingProcessesunder lock before deciding whether a process is already pending. - Refactor
StreamManagerto cache streams per peer (instead of per session) and adjust libp2p communication to use the new API. - Update/trim stream manager tests and fix a typo in a communication health test name.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
tss/coordinator.go |
Moves the lock to cover the pendingProcesses read to avoid unsynchronized map access. |
comm/p2p/manager.go |
Refactors stream cache from per-session to per-peer and introduces CloseStream + simplified Stream lookup/creation. |
comm/p2p/libp2p.go |
Switches sending to the peer-cached stream manager and changes session close behavior. |
comm/p2p/manager_test.go |
Updates tests for the new stream manager API and validates stream reuse. |
comm/health_test.go |
Fixes test name typo (“Pears” → “Peers”). |
Comments suppressed due to low confidence (1)
comm/p2p/libp2p.go:182
- sendMessage() reuses a single cached stream per peer and writes to it without per-peer serialization. Concurrent broadcasts to the same peer can interleave writes and corrupt the newline-delimited framing used by WriteStream/ReadStream; add per-peer write locking/queueing or avoid sharing a stream across concurrent senders.
stream, err = c.streamManager.Stream(to)
if err != nil {
return err
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MakMuftic
previously approved these changes
Feb 26, 2026
MakMuftic
approved these changes
Feb 26, 2026
|
Go Test coverage is 53.6 %\ ✨ ✨ ✨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Issue Or Context
Closes: #149
Closes: #150
How Has This Been Tested? Testing details.
Types of changes
Checklist: