How can it perform a rolling update without downtime? #4857
-
I'm hosting socket.io with a Redis stream adapter on ECS, and I'm encountering two issues when trying to perform a rolling update.
Does this feature only apply to client-side disconnections? What if the server crashes and restarts? Is there a way to restore a client's state in this case? Based on my investigation, it seems that the system treats reconnection as a new connection with a new socket ID and doesn't map the state to the reconnected client. Additionally, during the rolling out of pods, the server triggers events: "leave-room", "disconnect" and "delete-room" with showing the log below.
There is my application code that erases some states from Redis in "disconnect" event handler. Is there a standard solution for these issues? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi!
No, it also works when the Socket.IO server is cleanly stopped: process.on('SIGTERM', () => {
io.close();
}); The connections will be closed with a Lines 50 to 57 in 9a2a83f So the connection state will be persisted in the store (if the process has enough time to do so) and restored upon reconnection. |
Beta Was this translation helpful? Give feedback.
Hi!
No, it also works when the Socket.IO server is cleanly stopped:
The connections will be closed with a
server shutting down
reason, which is in the list of recoverable reasons:socket.io/lib/socket.ts
Lines 50 to 57 in 9a2a83f
So the connection state will be persisted in the store (if the process has enough time to do so) and re…