Open rawhat opened 1 year ago
Been randomly thinking about this off and on for, damn, I guess almost a year lol.
I think the approach would have to be something like this:
opaque type Server
instead of the raw Subject(supervisor.Message)
to allow something like glisten.shutdown(server)
and also glisten.get_supervisor(server)
(otherwise there's no way to tell it to shutdown since the supervisor doesn't receive custom messages)I think maybe we'll need a way to shut down the supervisor? Or otherwise tell it we're trying to shut down... need to test if normal shutdown will make the children restart (I would expect them to?).
You should be able to send a message to the top-level supervisor. This should stop accepting new connections and allow existing connections to complete. If everything is complete, it should shut down. If anything goes longer than the specified time, we should forcefully bring the process down.