RafalWilinski / express-status-monitor

🚀 Realtime Monitoring solution for Node.js/Express.js apps, inspired by status.github.com, sponsored by https://dynobase.dev
https://dynobase.dev/
MIT License
3.61k stars 255 forks source link

SetInterval Leak #22

Open FGRibreau opened 8 years ago

FGRibreau commented 8 years ago

At least ClearInterval should be called when the disconnect event is triggered by socket.io. Looking at the code, refreshing the page a lot of times would generate a self-deni-of-service :)

Don't hesitate to use setTimeout instead by the way.

RafalWilinski commented 8 years ago

Piece of code that you've marked is invoked only once - when io variable has been not set. Once io is set = socket.io server has started, selected block will not be executed.

Try putting console.log there and you'll see :)

Remember that it's server side code, not browser. Server creates socket.io server only once.

FGRibreau commented 8 years ago

Oh sorry! However the remark on setInterval vs setTimeout still stand :)