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

Suggestion to close remaining Connection gracefully without Grace #23

Open
vipreshjha opened this issue Feb 22, 2019 · 1 comment
Open

Comments

@vipreshjha
Copy link

vipreshjha commented Feb 22, 2019

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)
}
}
}

`

@glasser
Copy link

glasser commented Feb 23, 2021

What problem does this solve? Doesn't the res.once('finish') handler deal with this?

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