Durable objects scalability issue

Hi,

I am looking at the cloudflare workers durable objects chat demo and noticed this code: https://github.com/Betashares/edge-socket/blob/master/index.mjs#L153-L155

this.sessions = this.sessions.filter(session => {
        session.webSocket.send(message);
});

If it is looping over lots of sessions, possibly 50,000 websocket sessions can this be done in a scalable way? Is this the right approach to this? Wouldn’t each loop iteration create issues?

1 Like