Skip to content

Instantly share code, notes, and snippets.

View Furizaa's full-sized avatar
🔋
...

Andreas Hoffmann Furizaa

🔋
...
View GitHub Profile
@Furizaa
Furizaa / boot.js
Last active August 29, 2015 14:25 — forked from jdx/boot.js
// This script will boot the servers with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var chalk = require('chalk');
// Define how many workers to run on the system
const bindSelectors = (selectors, stateSlice) =>
Object.keys(selectors).reduce((prev, curr) =>
({ ...prev, [curr]: (...args) => {
const [state, ...rest] = args;
return selectors[curr](state[stateSlice], ...rest);
}}),
{}
);
// State