mayu-live / framework

Mayu is a live updating server-side component-based VDOM rendering framework written in Ruby
https://mayu.live
GNU Affero General Public License v3.0
130 stars 4 forks source link

Graceful shutdown + resuming sessions #15

Closed aalin closed 1 year ago

aalin commented 1 year ago

By default, Fly.io sends SIGINT to processes when shutting down.

When the server receives SIGINT, it should stop receiving requests, stop all sessions, serialize+encrypt them and send them to each client and close their connections.

As soon as the connection has been closed, it should make a POST to the resume endpoint which should then be received by another server.

It's not clear to me how to trap SIGINT inside the async containers..

aalin commented 1 year ago

Got something basic working, just need to integrate it with the metrics aggregator...

(the client on the right is first connected to the server in the bottom window, but when that server receives SIGINT, it will send session.transfer with the serialized state to the client, which will post the serialized session to another server which will resume the session)

qMkxYDjm2c

aalin commented 1 year ago

Fixed by #19