npm.io
1.0.6 • Published 10 years ago

ith

Licence
ISC
Version
1.0.6
Deps
4
Vulns
1
Weekly
0

Ith

Simple module for starting only single instance of node process across many servers. Ith uses redis as communication channel - for locking purposes.

Usage

  1. firstly you need to install Ith by:
npm install ith
  1. next you need to load Ith dependency into your startup file
var ith = require('ith');
  1. for Ith to be able to communicate between serwers you need to provide him some redis client, so be so nice and craete one for him:
var redis = require('redis');
var client = redis.createClient();
  1. then it's finally time to create Ith instance:
var letsRun = ith({
    redis: client,
    resourceName: 'turbo-node-process-to-start-only-once',
    processName: 'path/to/your/turbo-node-process-to-start-only-once.js',
    extendInterval: 1200,
    ttl: 2000
});

letsRun.start(function() {
    console.log('start');
});

Keywords