hunterloftis / hunterloftis/stoppable
stop() returning a promise and not decorating the server
- Dominant language
- JavaScript
- Stars
- 404
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
I'm curious whether folks are interested in revisiting some of the design decisions.
For one it'd be interesting if `stoppable()` could *return* the `stop()` function, rather than assigning it to the `server` value. Calling code could still do `server.stop = stoppable(server)`. Personally I don't find the chaining argument convincing.
It'd also be neat if `stop()` would return a promise, rather than taking a callback. It wouldn't match the `server.close()` API but in these glorious days of `async / await` I think returning a promise would be more usable.
Once `stop()` no longer takes a callback it'd be possible to pass `grace` directly.
These last two changes combined make it possible to use `stoppable` with https://www.npmjs.com/package/@digicat/termination-manager (which, full disclaimer, I wrote). That library can vary the `grace` period based on whether the process is crashing or merely terminating, which doesn't work with `stoppable` as-is.
If folks disagree I'm happy to publish a fork elsewhere but I figured I'd ask first. These nits aside `stoppable` is the nicest library I've found for stopping servers 🥇
Thanks for reading this far!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.