personalrobotics / feeding_web_interface

Web interface for the robot-assisted feeding system
1 stars 0 forks source link

Make `server.js` delete old peer connections on the same IP #118

Closed amalnanavati closed 10 months ago

amalnanavati commented 10 months ago

Before this PR, server.js created a new peer connection for every new registered publisher/subscriber. This was intentional, to allow multiple devices to simultaneously register to the robot's video stream (e.g., to test latency). However, this also means that throughout the course of the meal, more and more peer connections are created, which hugely increases the CPU utilization of server.js (we saw it go up to 500%).

This PR addresses that by only allowing one publisher and subscriber per topic at a time. (Note: in theory this should allow for a different subscriber per IP, but in practice all the IPs end up being the same -- unclear why -- resulting in this only allowing one publisher/subscriber per topic at once.)

Testing: On lovelace: