1.0.0 • Published 8 years ago

when-master v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 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

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago