gajus / gajus/http-terminator

Does terminator need to be created before accepting connections?

Open
#42 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
335
Forks
29
PR merge metrics
No merged PRs in 30d

Description

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:
```js
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();
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.