Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does terminator need to be created before accepting connections? #42

Open
devinivy opened this issue Dec 16, 2022 · 1 comment
Open

Comments

@devinivy
Copy link

devinivy commented Dec 16, 2022

Small question here! I know that http-terminator tracks some state about the server, e.g. active sockets, in order to do its job. Does that imply that the terminator needs to be created before the server starts serving requests, so that it can track the state of the server prior to termination? I think it could be easy to assume you can just create the terminator at the moment you want to start tearing down the server, so I want to confirm whether or not that is intended usage. Thank you!

Example:

const server = http.createServer();
// Serve some requests
// Begin teardown
const httpTerminator = createHttpTerminator({ server });
await httpTerminator.terminate();

// ... or ...

const server = http.createServer();
const httpTerminator = createHttpTerminator({ server });
// Serve some requests
// Begin teardown
await httpTerminator.terminate();
@aeddie-zapidhire
Copy link

The answer seems to be yes, it needs to be set up before accepting connections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants