Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1518

how to stop accepting new requests before closing existing ones?

$
0
0

This runs without error:

const app = express();const server = app.listen(3900, '0.0.0.0', () => {  console.log('listening...');});process.once('SIGINT', () => {  console.log('got SIGINT.')  setTimeout(() => {    console.log('ending process due to SIGINT + subsequent Timeout.')    process.exit(0);  }, 3000);  server.closeIdleConnections();  // <<<  server.closeAllConnections();  // <<<<  server.close(err => {    if (err) {      console.error(err);    }    console.log('closed server, and now shutting down due to SIGINT.')    process.exit(0);  });});

but my question is - is this the best way to stop accepting new connections before ending the existing connections/requests?

how are "idle" connections defined?


Viewing all articles
Browse latest Browse all 1518

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>