Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Graceful shutdown & startup are two use cases that I used this for, just today.

When my express server gets a SIGTERM I want it to stop accepting new requests but finish pending requests before exiting.

Likewise during startup, the HTTP server is currently up before all resources are available - DB backends and the like. So I await a .ready promise before all requests iff we are not inited.

It can be abused into spaghetti for sure, but actual use cases are not that exotic imho



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: