[erlang-questions] patterns or best practices to shut applications down?
Xavier Noria
fxn@REDACTED
Sat Dec 23 15:27:18 CET 2017
Chatted a bit with José Valim about this.
I had read the APIs related to process shutdown, but I had not seen the big
picture. A conventionally written OTP application has a way to boot, but
had not grasped that it has also a way to shutdown and you program to play
well wit it. Aha!
So the auto-answer to my question (please don't hesitate to correct me or
add anything) is that every service needs to take a conscious decision
about this. Logic, timeouts, and so on. In some cases exiting is going to
be inmediate. A periodical task may wait for completion if exiting happens
in the middle of it, but schedule no more runs (off the top of my head). In
the case of a somewhat long-running process like file uploading, guess a
normal strategy would be similar: to allow their exit handlers to wait for
the upload to complete and program this logic. Their supervisor would set
appropriate generous timeouts or infinity accordingly. In such a system it
is a consequence of this that you should expect shutdown to take whatever
those processes need.
Beautifull!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20171223/2f16d653/attachment.htm>
More information about the erlang-questions
mailing list