Skip to content

topfreegames/pomelo-graceful-shutdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pomelo Graceful Shutdown Component

Example Usage

Make pomelo use the component:

var GracefulShutdown = require('pomelo-graceful-shutdown')

...
...

app.configure('all', 'connector', function(){
  ...
  ...
  app.use(GracefulShutdown, {
    gracefulShutdown: {
      checks: [
        () => {
          if (app.numRooms > 0) {
            return false;
          }
          return true
        }
      ],
      signals: ['SIGTERM'],
      before: () => {
        console.log("before")
      },
      shouldExit: true,
      timeout: 30,
    }
  })
  ...
  ...
})