[racket] Closing down the web server

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Oct 8 15:23:34 EDT 2012

All the functions that start the Web server (such as serve) return a
function that with close the server when called.

All that function does is start the server with a particular custodian
and then kills that custodian when you call the function. Any
resources that the server allocates would have their will executors
run. (The custodian controls the resources... killing it will cause
the will executor to run on the resources, unless the process is
killed, in which case nothing is normally run.)

I don't have any Web apps that are started by anything other than a
shell, so I always just Ctrl-C to quit.


On Sun, Oct 7, 2012 at 12:27 PM, Norman Gray <norman at astro.gla.ac.uk> wrote:
> Greetings.
> What's the recommended way of shutting down the Racket web server?
> In the past, I've just killed the process -- *boom*!  This basically works (and would of course be perfectly all right in the case of a fully stateless service), but seems dangerously abrupt, and probably doesn't play nice with stateful things like database connections.
> I can't find any guidance in the web-server manual.
> I don't want to do anything too exotic, beyond shutting down a database connection, and exiting nice and neatly with a success status.
> Is a will or custodian the right thing to use to do this cleanup, in the context of a process kill? (I confess to being rather uncertain about how to use either of those, but if I know where to start I can surely work it out).
> Best wishes,
> Norman
> --
> Norman Gray  :  http://nxg.me.uk
> SUPA School of Physics and Astronomy, University of Glasgow, UK
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.