hunterloftis / hunterloftis/stoppable
Suggestion to close remaining Connection gracefully without Grace
- Dominant language
- JavaScript
- Stars
- 404
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
Why cant we have a function that keps on checking remaining sockets and close them. It will be called in stop().
`
function stop (callback) {
// allow request handlers to update state before we act on that state
setImmediate(() => {
stopped = true
if (grace < Infinity) {
setTimeout(destroyAll, grace).unref()
}
server.close(e => {
if (callback) {
callback(e, gracefully)
}
})
reqsPerSocket.forEach(endIfIdle)
if (!grace)
closeRemaining(reqsPerSocket);
})
}
function closeRemaining(reqsPerSocket){
if(reqsPerSocket.size>0)
{
reqsPerSocket.forEach(endIfIdle);
if(reqsPerSocket.size>0){
setTimeout(closeRemaining, 1000)
}
}
}
`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.