peers / peerjs-server

Server for PeerJS
https://peerjs.com
MIT License
4.26k stars 1.08k forks source link

Unnecessary high CPU impact due to low default check interval of broken connections #400

Open jr-dimedis opened 1 year ago

jr-dimedis commented 1 year ago

I am using PeerJS server v1.0.0 and see in the source code that the checkBrokenConnections module runs a timer at 300ms interval which checks for a timeout for all connected clients.

This timeout is by default 60000ms. So I am asking why is it necessary to check for broken connections every 300ms?

I think reducing this to the ping default value of 5000ms would decrease CPU impact significantly and it would catch a client timeout maximum 5 seconds later (worst case) which does make no big difference in my opinion (max. of ~65s timeout instead of ~60.3s timeout).

Or am I missing something here?

jonasgloning commented 1 year ago

@afrokick chose the setting; maybe he can chime in