This is not GitHub.com

Like what you see? Install OctoLinker now!

Skip to content
Permalink
Browse files
Gracefully shutdown: exit after server is closed (#418)
  • Loading branch information
Kikobeats committed Jul 30, 2021
1 parent 9861102 commit 9e0fbdaacd2681afda232308fdeb04fc8e87a05a
Showing with 5 additions and 4 deletions.
  1. +5 −4 packages/micro/bin/micro.js
@@ -204,8 +204,11 @@ function startEndpoint(module, endpoint) {

server.listen(...endpoint, () => {
const details = server.address();

registerShutdown(() => server.close());
registerShutdown(() => {
console.log('micro: Gracefully shutting down. Please wait...');
server.close();
process.exit();
});

// `micro` is designed to run only in production, so
// this message is perfectly for prod
@@ -225,8 +228,6 @@ async function start() {
for (const endpoint of args['--listen']) {
startEndpoint(loadedModule, endpoint);
}

registerShutdown(() => console.log('micro: Gracefully shutting down. Please wait...'));
}

start();

0 comments on commit 9e0fbda

Please sign in to comment.