Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (29 sloc) 1.34 kB

Reload

Restart the server the given js files have changed. files may be several directories, filenames, etc, defaulting to the script's directory.

Options

  • signal Signal to send, defaults to SIGTERM
  • interval Watcher interval, defaulting to 100

Usage

The reload(paths[, signal]) plugin accepts a single path, or an array of paths, watching for mtime changes, and re-loading the workers when a change has been made. By default the SIGTERM signal is sent, killing the workers immediately, however we may pass a signal for graceful termination as well.

Reload when files in ./ (__dirname) change:

    cluster(server)
      .use(cluster.reload())
      .listen(3000);

Reload when files in ./lib change:

    cluster(server)
      .use(cluster.reload('lib'))
      .listen(3000);

Reload when files in ./lib, ./tests, or the ./index.js file change:

    cluster(server)
      .use(cluster.reload(['lib', 'tests', 'index.js']))
      .listen(3000);

Graceful shutdown:

   cluster(server)
    .use(cluster.reload('lib', { signal: 'SIGQUIT' }))
    .listen(3000);

Watching coffee-script files as well.

   cluster(server)
     .use(cluster.reload('lib', { extensions: ['.js', '.coffee'] }))
     .listen(3000);
Jump to Line
Something went wrong with that request. Please try again.