Skip to content

Disco server#10

Merged
ConnorNeed merged 3 commits into
mainfrom
disco-server
May 4, 2026
Merged

Disco server#10
ConnorNeed merged 3 commits into
mainfrom
disco-server

Conversation

@ConnorNeed

Copy link
Copy Markdown
Member

Adds a buffering limit to avoid crashes and launches using the ros2 discovery server

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 safeSend helper with a bufferedAmount threshold for WebSocket log streaming.
  • Add a new scienceStreaming launch 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 thread src/LogManager.ts
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;
}
Comment thread src/LogManager.ts Outdated
for (const line of entry.buffer) {
if (ws.readyState !== ws.OPEN) break;
ws.send(line);
this.safeSend(ws, line);
Comment thread src/server.ts
Comment on lines +25 to +28
Env: [
'ROS_DOMAIN_ID=0',
'ROS_DISCOVERY_SERVER=192.168.0.55:11811',
],

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 thread src/server.ts
Comment on lines +25 to +28
Env: [
'ROS_DOMAIN_ID=0',
'ROS_DISCOVERY_SERVER=192.168.0.55:11811',
],
Comment thread src/LogManager.ts
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;
@ConnorNeed
ConnorNeed merged commit 7a66566 into main May 4, 2026
5 checks passed
@ConnorNeed
ConnorNeed deleted the disco-server branch July 10, 2026 19:19
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