Disco server#10
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds ROS 2 discovery server configuration for launched containers and introduces a WebSocket backpressure guard intended to prevent log-stream-related crashes.
Changes:
- Set default ROS-related environment variables on all launched containers (domain ID + discovery server endpoint).
- Add a
safeSendhelper with abufferedAmountthreshold for WebSocket log streaming. - Add a new
scienceStreaminglaunch option.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/server.ts |
Adds ROS environment variables to the shared Docker container create configuration. |
src/LogManager.ts |
Introduces a WebSocket buffered-amount guard via safeSend and applies it to some send paths. |
src/config/launchOptions.ts |
Adds the scienceStreaming ROS launch option. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+67
to
+79
| private safeSend(ws: WebSocket, data: string | Buffer): boolean { | ||
| if (ws.readyState !== WebSocket.OPEN) { | ||
| return false; | ||
| } | ||
|
|
||
| if (ws.bufferedAmount > MAX_WS_BUFFERED_AMOUNT) { | ||
| ws.close(1013, 'Log stream too fast. Stopping to avoid crash.'); | ||
| return false; | ||
| } | ||
|
|
||
| ws.send(data); | ||
| return true; | ||
| } |
| for (const line of entry.buffer) { | ||
| if (ws.readyState !== ws.OPEN) break; | ||
| ws.send(line); | ||
| this.safeSend(ws, line); |
Comment on lines
+25
to
+28
| Env: [ | ||
| 'ROS_DOMAIN_ID=0', | ||
| 'ROS_DISCOVERY_SERVER=192.168.0.55:11811', | ||
| ], |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+25
to
+28
| Env: [ | ||
| 'ROS_DOMAIN_ID=0', | ||
| 'ROS_DISCOVERY_SERVER=192.168.0.55:11811', | ||
| ], |
Comment on lines
+72
to
+78
| if (ws.bufferedAmount > MAX_WS_BUFFERED_AMOUNT) { | ||
| ws.close(1013, 'Log stream too fast. Stopping to avoid crash.'); | ||
| return false; | ||
| } | ||
|
|
||
| ws.send(data); | ||
| return true; |
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.
Adds a buffering limit to avoid crashes and launches using the ros2 discovery server