Awesome - thanks! I wonder if using serve, instead of serve/servlet, may 
also avoid the extra functionality described in "Stateless Servlets" that I 
mentioned in another thread here:

https://groups.google.com/forum/#!topic/racket-users/fc0mRI-empE

On Friday, November 30, 2018 at 1:57:00 PM UTC-5, Bogdan Popa wrote:
>
>
> Brian Adkins writes: 
>
> > I just did a quick test, and "kill <pid>" will stop the Racket web 
> server, 
> > but not gracefully. In other words, it doesn't allow the current request 
> to 
> > finish. Maybe another signal will gracefully stop it? 
>
> I personally run the server with serve[1] which runs it in a background 
> thread and I keep a reference to the returned stopper function and 
> finally do something along the lines of 
>
>     (with-handlers ([exn:break? (lambda (e) (stopper))]) 
>       (sync/enable-break never-evt)) 
>
> in my main thread.  As I understand it[2], exn:break? will be truthy for 
> SIGINT, SIGTERM and SIGHUP (though there are also the exn:break:hang-up? 
> and exn:break:terminate? predicates) on UNIX, so this should "catch" all 
> of those and gracefully terminate my server. 
>
> [1]: 
> https://docs.racket-lang.org/web-server-internal/web-server.html?q=serve#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%29%29
>  
> [2]: https://docs.racket-lang.org/reference/breakhandler.html?q=breaks 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to