mount

mjmeintjes 2018-02-06T00:33:09.000058Z

Hi. Is there support for asynchronous stop functions when using mount with ClojureScript. I'm looking to manage the nodejs http server with mount and the close function is async - i.e. it has a callback that is called once connections are closed. Is this something that mount supports in some way?

tolitius 2018-02-06T03:00:15.000071Z

@mjmeintjes can this callback be #(mount/stop "#'whatever-needs-to-stop")?

mjmeintjes 2018-02-06T23:55:13.000298Z

@tolitius I'm not sure I understand completely how that would work. For nodejs http server, there is a .close function, which takes as its only argument a callback function that it calls when it has finished closing down (i.e. a "done" function). It does this because it has to wait for any connection to be closed before shutdown can be said to be finished, and in javascript you can't block. I'm just wondering whether mount has support for this concept - i.e. when calling mount/stop, is there a way to indicate that shutdown is "in progress" and that it has to wait for a callback function to be called.

mjmeintjes 2018-02-06T23:55:59.000187Z

https://nodejs.org/api/net.html#net_server_close_callback

mjmeintjes 2018-02-06T23:56:40.000241Z

https://shadow-cljs.github.io/docs/UsersGuide.html#_lifecycle_hooks - see :before-load-async