1.0.0 • Published 9 years ago

when-master v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

When Master

Utility to request a master role in a multi server cluster.

Why

This works well in pm2 or other environments where we want one process to do something, but not necessarily the master. It works by creating a temporary file that stores the pid of the first process to call the function.

Installation

Npm

npm install when-master

Usage

var whenMaster = require("when-master");

// In process A
whenMaster("appA"); //-> true

// In process B
whenMaster("appA"); //-> false
whenMaster("appB"); //-> true

// Later in process A
whenMaster("appB"); //-> false

// In process B after process A exits
whenMaster("appA"); //-> true
1.0.0

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago