npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yacm

v0.0.2

Published

Yet another cluster master. Simple worker manager with rolling reload and file watchers

Downloads

3

Readme

yacm

Yet another cluster master (yacm). Simple worker manager with rolling reload and file watchers

Synopsis

Setup

  var master = require('yacm');
  if(master.isMaster) {
    var files = [file_to_watch1, file_to_watch2];
    master.run({watchFiles: files});
  } else {
    //Your normal worker code here
    run();
  }
};

API

Starting up

master.run(options);

Sets some options and starts up workers.

###Shutting down

master.shutdown();

Stops all workers.

Note: workers are stopped automatically when process exists, so you probably do not need to call this.

Reloading workers

master.reload();

This will schedule reload of workers. Reload happens in rolling manner and there are some configuration options you might want to tune, see below.

This function is clever enough to schedule single reload after multiple calls. It also schedules pending reload if one is already running.

###Configuration options

Some additional configuration options can be passed to master.run():

  • "reloadDelay": A grace perion in ms to wait after master.reload had been called before actually starting reload. Default: 5000.
  • "disconnectTimeout": A timeout to wait for worker to disconnect. Worker will be killed if it doesn't disconnect by then. Default: 2000.
  • "startupTimeout": A timeout to wait for new worker to start listening. Worker will be killed and restarted if it doesn't start listening by then. Default: 5000.
  • "workers": Number of workers to keep running. Default: 2/
  • "parallelReloads": Number of workers to be concurrently reloading. During reload process up to this number of workers will be started up while old workers dying off. Default: 1.
  • "watchFiles": Arrays of file paths to watch. Default: [].
  • "watchCallback": A callback to call when whatched file changed. Default: some reasonable code to reload everything.

Events

This module emits the following events (see EventEmitter for details):

  • 'reload': this event is emited just before reload process is started (after "reloaDelay" has been waited). This is the right time to start whatever changes whatching process you might have.

  • 'shutdownDone': the shutdown had been completed.

  • 'reloadDone': the reload had been completed.

  • 'startupDone': the startup had been completed.