{"_id":"throng","_rev":"42-4b1d2b98f5e5f57b115c05cfb966cd36","name":"throng","description":"A simple worker-manager for clustered apps","dist-tags":{"latest":"5.0.0"},"versions":{"1.0.0":{"name":"throng","version":"1.0.0","description":"A simple worker-manager for clustered apps","keywords":["cluster","worker","process"],"repository":{"type":"git","url":"https://github.com/hunterloftis/throng"},"homepage":"https://github.com/hunterloftis/throng","bugs":{"url":"https://github.com/hunterloftis/throng/issues"},"main":"index.js","scripts":{"test":"mocha"},"engines":{"node":">= 0.10.x"},"author":{"name":"Hunter Loftis","email":"hunter@hunterloftis.com"},"license":"MIT","devDependencies":{"chai":"^1.9.1","mocha":"^1.21.4"},"gitHead":"42cc3b9cda4bf004c6dd52b1b1780c3a45597eb6","_id":"throng@1.0.0","_shasum":"d9549fedcb097c0dfab7bbbfe16c79a6c49faba1","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"hunterloftis","email":"hunter@hunterloftis.com"},"maintainers":[{"name":"hunterloftis","email":"hunter@hunterloftis.com"}],"dist":{"shasum":"d9549fedcb097c0dfab7bbbfe16c79a6c49faba1","tarball":"https://registry.npmjs.org/throng/-/throng-1.0.0.tgz","integrity":"sha512-qR1et/wHAUosFpE0wlVt33TtAdTC0b2lXFUT5LntCPgnhdw8Kki2UHQ65DTUWTqNgkTA7X7j6VFmgvnAerNMpw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMQoW84QfrO2Xi/fhjsFP91qyeeR1QIF8UTBdCoJ0zogIhAIZh7NMTpMOQ4xxn01e1JUw6Nv8J7+oVm0mlKijAZzF8"}]},"directories":{}},"1.0.1":{"name":"throng","version":"1.0.1","description":"A simple worker-manager for clustered apps","keywords":["cluster","worker","process"],"repository":{"type":"git","url":"https://github.com/hunterloftis/throng"},"homepage":"https://github.com/hunterloftis/throng","bugs":{"url":"https://github.com/hunterloftis/throng/issues"},"main":"index.js","scripts":{"test":"mocha"},"engines":{"node":">= 0.10.x"},"author":{"name":"Hunter Loftis","email":"hunter@hunterloftis.com"},"license":"MIT","devDependencies":{"chai":"^1.9.1","mocha":"^1.21.4"},"gitHead":"b47b86bc4cd2072af032259bf41a593b0c9bb34f","_id":"throng@1.0.1","_shasum":"121d3bbcc025b98a350937176be467076749b676","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"hunterloftis","email":"hunter@hunterloftis.com"},"maintainers":[{"name":"hunterloftis","email":"hunter@hunterloftis.com"}],"dist":{"shasum":"121d3bbcc025b98a350937176be467076749b676","tarball":"https://registry.npmjs.org/throng/-/throng-1.0.1.tgz","integrity":"sha512-1zne48Y1mfgBWKmkmf1D/SgKquFxGz4AVdAo4uGPEC6X7usBxhkymd1RSNk6qGrSKLBDaQixzmFhJERP9iS+GQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHCQVzYXFWvQ3stpZ8w15KqgN+pcF/yVM7gvr9ZjN6/gAiAypfHZM5/r+FZIaDpqaPGcbcjNXn33/y9/+JGPsl77bQ=="}]},"directories":{}},"2.0.0":{"name":"throng","version":"2.0.0","description":"A simple worker-manager for clustered apps","keywords":["cluster","worker","process"],"repository":{"type":"git","url":"git+https://github.com/hunterloftis/throng.git"},"homepage":"https://github.com/hunterloftis/throng","bugs":{"url":"https://github.com/hunterloftis/throng/issues"},"main":"index.js","scripts":{"test":"mocha"},"engines":{"node":">= 0.10.x"},"author":{"name":"Hunter Loftis","email":"hunter@hunterloftis.com"},"license":"MIT","devDependencies":{"chai":"3.5.0","mocha":"2.4.5"},"dependencies":{"lodash":"4.3.0"},"gitHead":"65f907fdf06c90db4711fa083e0c9795c59268ba","_id":"throng@2.0.0","_shasum":"ee6cfde93535f8be991fb3b161a975727cc0a08c","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.1","_npmUser":{"name":"hunterloftis","email":"hunter@hunterloftis.com"},"dist":{"shasum":"ee6cfde93535f8be991fb3b161a975727cc0a08c","tarball":"https://registry.npmjs.org/throng/-/throng-2.0.0.tgz","integrity":"sha512-iA7SSnRmPpj1HHAtQuarrZZHv1KQbkkIWgID4C/M/ceLb9tEYZLZVFNPXbNnsloZFn9UTAVm9lLDnD8VTSFSZQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHM4Bl+66Ui/SkAnBYjXeq6hmwQMQcL24HdQV8cGi4e7AiEA+vcPGY8Vffr6z0gYfng+KGqXjRvqq+d/ebJCbVOZXEo="}]},"maintainers":[{"name":"hunterloftis","email":"hunter@hunterloftis.com"}],"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/throng-2.0.0.tgz_1455224046505_0.46837036730721593"},"directories":{}},"2.0.1":{"name":"throng","version":"2.0.1","description":"A simple worker-manager for clustered apps","keywords":["cluster","worker","process"],"repository":{"type":"git","url":"git+https://github.com/hunterloftis/throng.git"},"homepage":"https://github.com/hunterloftis/throng","bugs":{"url":"https://github.com/hunterloftis/throng/issues"},"main":"index.js","scripts":{"test":"mocha"},"engines":{"node":">= 0.10.x"},"author":{"name":"Hunter Loftis","email":"hunter@hunterloftis.com"},"license":"MIT","devDependencies":{"chai":"3.5.0","mocha":"2.4.5"},"dependencies":{"lodash":"4.3.0"},"gitHead":"94cbee0d7531badfbc8beab0f72713e910500131","_id":"throng@2.0.1","_shasum":"3c3b3b2acf88e5f501de13f2e895425f4adc5b4e","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.1","_npmUser":{"name":"hunterloftis","email":"hunter@hunterloftis.com"},"dist":{"shasum":"3c3b3b2acf88e5f501de13f2e895425f4adc5b4e","tarball":"https://registry.npmjs.org/throng/-/throng-2.0.1.tgz","integrity":"sha512-HqDVA7o2GhN6IQmHK2FtqPqzsD48BWZlf5tAVAeD9AddeckolO7c3M5OQvu3LYZuRf5uiXUJ7XS7PL5DKY+Fww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDXKnUDNXHj2kep68A9Yu5zKc+zxmDNhj9GJJmSEHaHugIhAM1SpnJk5sCd9YN3ZFVA5ULekfDYwmxqXgIN8Z1iLOiP"}]},"maintainers":[{"name":"hunterloftis","email":"hunter@hunterloftis.com"}],"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/throng-2.0.1.tgz_1455298041791_0.6420092980843037"},"directories":{}},"3.0.0":{"name":"throng","version":"3.0.0","description":"A simple worker-manager for clustered apps","keywords":["cluster","worker","process"],"repository":{"type":"git","url":"git+https://github.com/hunterloftis/throng.git"},"homepage":"https://github.com/hunterloftis/throng","bugs":{"url":"https://github.com/hunterloftis/throng/issues"},"main":"lib/throng.js","files":["lib"],"scripts":{"test":"mocha"},"engines":{"node":">= 4.0.0"},"author":{"name":"Hunter Loftis","email":"hunter@hunterloftis.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","mocha":"^2.4.5"},"dependencies":{"lodash.defaults":"^4.0.1"},"gitHead":"8a782f13209e75d8d3989a1a00957c0cc63e782a","_id":"throng@3.0.0","_shasum":"0a2dec46ceb17599094dedf30adf05c001fe2bf3","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"hunterloftis","email":"hunter@hunterloftis.com"},"dist":{"shasum":"0a2dec46ceb17599094dedf30adf05c001fe2bf3","tarball":"https://registry.npmjs.org/throng/-/throng-3.0.0.tgz","integrity":"sha512-/+IkjTxxMfCiewGeXsv9+y0gDmW7IH4kRNHXfdZeNHLIv+4ZCqQm88IPucOmj4N8e3OXNfJGhYl9y6um6BtjOg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzLz9fj0TFAnr2RJWGIbUF8PT5fMPJLdu77DSNLg+ksQIgRZzW7mTkEunFFTsGqM+LJjmNp9T8ep0jjGHESix4I6Y="}]},"maintainers":[{"name":"hunterloftis","email":"hunter@hunterloftis.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/throng-3.0.0.tgz_1458771005549_0.8472004618961364"},"directories":{}},"4.0.0":{"name":"throng","version":"4.0.0","description":"A simple worker-manager for clustered apps","keywords":["cluster","worker","process"],"repository":{"type":"git","url":"git+https://github.com/hunterloftis/throng.git"},"homepage":"https://github.com/hunterloftis/throng","bugs":{"url":"https://github.com/hunterloftis/throng/issues"},"main":"lib/throng.js","files":["lib"],"scripts":{"test":"mocha"},"engines":{"node":">= 4.0.0"},"author":{"name":"Hunter Loftis","email":"hunter@hunterloftis.com"},"license":"MIT","devDependencies":{"chai":"^3.5.0","mocha":"^2.4.5"},"dependencies":{"lodash.defaults":"^4.0.1"},"gitHead":"e585aa4997085b32a603983c36dce6f71ed1b91a","_id":"throng@4.0.0","_shasum":"983c6ba1993b58eae859998aa687ffe88df84c17","_from":".","_npmVersion":"3.8.3","_nodeVersion":"5.10.1","_npmUser":{"name":"hunterloftis","email":"hunter@hunterloftis.com"},"dist":{"shasum":"983c6ba1993b58eae859998aa687ffe88df84c17","tarball":"https://registry.npmjs.org/throng/-/throng-4.0.0.tgz","integrity":"sha512-agGzKEr7u/rdxXmLIDfYa23IOS3MklSzSshPBdWgydpbWhPFFtleC2QFtNXIOKCHoXtdIxVYZoZ+MN54kGCk0g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLS4oPhdoPzayoo3M59WBk1J52iIW2HqTl4AM+J8SH3QIgGCcvvCx5HM10QpL5riZVkh9LHZu1l/3TK4PDPR3M+U8="}]},"maintainers":[{"name":"hunterloftis","email":"hunter@hunterloftis.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/throng-4.0.0.tgz_1460614908610_0.9267617627047002"},"directories":{}},"5.0.0":{"name":"throng","version":"5.0.0","description":"A simple worker-manager for clustered apps","keywords":["cluster","worker","process"],"repository":{"type":"git","url":"git+https://github.com/hunterloftis/throng.git"},"homepage":"https://github.com/hunterloftis/throng","bugs":{"url":"https://github.com/hunterloftis/throng/issues"},"main":"lib/throng.js","scripts":{"test":"mocha","test:bail":"mocha --bail"},"engines":{"node":">= 10"},"author":{"name":"Hunter Loftis","email":"hunter@hunterloftis.com"},"license":"MIT","devDependencies":{"chai":"^4.2.0","mocha":"^8.1.3"},"dependencies":{"lodash":"^4.17.20"},"gitHead":"e08ecbe056da301dccd74be8dc6bdb3f6494e50e","_id":"throng@5.0.0","_nodeVersion":"13.12.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-nrq7+qQhn/DL8yW/wiwImTepfi6ynOCAe7moSwgoYN1F32yQMdBkuFII40oAkb3cDfaL6q5BIoFTDCHdMWQ8Pw==","shasum":"f9550c0221e579073f68a00be33a593d094e4d29","tarball":"https://registry.npmjs.org/throng/-/throng-5.0.0.tgz","fileCount":3,"unpackedSize":6505,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfaDIxCRA9TVsSAnZWagAAOXUP/i7oOmhZpLUm/97Q/W89\nDUSOdZZth1k2uG4vi5lytigEbC4i6KfG3NX6ge5lcQfcBboEHEhI+IE8C9NL\nsDV129Hk7jAS1qASGGgVFiAPAnDh3UtTSINGU7l3WNFMksECmzRnYT5hjzKE\nJgqDUMkZ/EP0cq3/lbYTuYkFlFlJukYuTNdTLD8/gUrlai+bYc2J2ma/X8Bu\nwAY+Cyc4/fodShHxwijKfgV/oLxITg6ml8OlVR0qPUwQFQULEYaO4jWSjFcY\nY+cWVCcXo+WXF1DXvyE8VOuk1vpqnM6518nZrjAJwmK9t1IxxG3pktWscNTC\nZmzgBDkRN4e+jz4OLvurwi5SirISv7Sxf8x/tMsT/4D4QlzTxr9G6OU+ZEld\nVL9D9A+fJricoI1oZS7cI9x/ridcLFBbNyOFZF14HWivLho5AqBxqm6T8WU6\nEf4lXurBHpPW3QTurMiXWEdTnsxZuqBeryg8YvMcFEm9wNUnk+Qh/jbUp4AM\npWpyV5Kq1BrN3j9xNQ5AZXmCMPCLL0xa8pJbOOowbGedYT8l1PgiqbdPMSRE\nCU//KlNn7O08wLPfF9s3rkNLDEYNCAd3NZAWyDFq8a8ZsEM0sDTznBlD2qb9\nUsCWjbncxi4Z1IQPnyP8wUJpqnsmgMQR7XYKs1Aa878LGFrRJNaGc0MWDKMc\n6vfz\r\n=wioV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzVBuVO7Z+jGCZVsOksIZk7kropjwwSoO3NPOUrY5QrwIhAIFM9oqOlXPaBvsNzklnESAKo6GStVNfsJ2dYJ4OW+Ny"}]},"maintainers":[{"name":"hunterloftis","email":"hunter@hunterloftis.com"}],"_npmUser":{"name":"hunterloftis","email":"hunter@hunterloftis.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/throng_5.0.0_1600664113349_0.013752191668354063"},"_hasShrinkwrap":false}},"readme":"# Throng\n\nDead-simple one-liner for clustered Node.js apps.\n\nForks N workers and creates new ones if they go down.\nCorrectly handles signals from the OS.\n\n```js\nconst throng = require('throng')\n\nthrong(id => console.log(`Started worker ${id}`))\n```\n\n```\n$ node example\nStarted worker 1\nStarted worker 2\nStarted worker 3\nStarted worker 4\n```\n\n## Installation\n\n```\n$ npm install --save throng\n```\n\n## Use\n\n### Fork 1 worker per CPU:\n\n```js\nthrong(workerStartFunction)\n```\n\n### Specify the number of workers:\n\n```js\nthrong({ worker: workerStartFunction, count: 3 })\n```\n\n### More options:\n\n```js\nthrong({\n  master: masterStartFunction,\n  worker: workerStartFunction,\n  count: 16,\n  grace: 1000\n})\n```\n\n### Handling signals:\n\n(for cleaning up before disconnecting a worker on a SIGTERM, for instance)\n\n```js\nthrong({ worker })\n\nfunction worker(id, disconnect) {\n  console.log(`Started worker ${id}`)\n\n  process.on('SIGTERM', () => {\n    console.log(`Worker ${id} exiting (cleanup here)`)\n    disconnect()\n  })\n})\n```\n\n## All options (with defaults)\n\n```js\nthrong({\n  master: masterFn,               // Fn to call in master process (can be async)\n  worker: workerFn,               // Fn to call in cluster workers (can be async)\n  count: 4,                       // Number of workers (cpu count)\n  lifetime: Infinity,             // Min time to keep cluster alive (ms)\n  grace: 5000,                    // Grace period between signal and hard shutdown (ms)\n  signals: ['SIGTERM', 'SIGINT']  // Signals that trigger a shutdown (proxied to workers)\n})\n```\n\n## A complex example\n\n```js\nconst throng = require('throng')\n\nthrong({ master, worker, count: 4 })\n\n// This will only be called once\nfunction master() {\n  console.log('Started master')\n\n  process.once('beforeExit', () => {\n    console.log('Master cleanup.')\n  })\n}\n\n// This will be called four times\nfunction worker(id, disconnect) {\n  console.log(`Started worker ${ id }`)\n  process.once('SIGTERM', shutdown)\n  process.once('SIGINT', shutdown)\n\n  function shutdown() {\n    console.log(`Worker ${ id } cleanup.`)\n    disconnect()\n  }\n}\n```\n\n```\n$ node example-complex.js\nStarted master\nStarted worker 1\nStarted worker 3\nStarted worker 2\nStarted worker 4\n^C\nWorker 1 cleanup.\nWorker 3 cleanup.\nWorker 2 cleanup.\nWorker 4 cleanup.\nMaster cleanup.\n```\n\n## Staying alive\n\nThrong forks replacements for workers that crash so your cluster can continue working through failures.\n\n```\n$ node example-crashy.js\n-1--2--3--4--2--1--3--4--crash!--1--3--4--crash!--5--3--4--6--5--3--4--crash!--6--crash!--crash!--7--6--8--9--7--6--8--9--crash!--7--6--9--10--7--6--9--10--crash!--7--9--10--11--7--crash!--9--crash!--7--12--9--13--crash!--12--9--crash!--crash!--crash!--14--crash!--12--15--crash!--14--18--15--19--14--18--15--crash!--19--14--crash!--15--20--14--21--15--20--14--21--15--20--14--21--15--20--14--21--15-\n```\n\n## Test\n\n```\n$ docker-compose run --rm dev\n\nnode@docker:/home/app$ npm test\n```\n","maintainers":[{"name":"hunterloftis","email":"hunter@hunterloftis.com"}],"time":{"modified":"2022-06-27T06:23:25.753Z","created":"2014-08-28T02:25:25.962Z","1.0.0":"2014-08-28T02:25:25.962Z","1.0.1":"2015-09-10T15:37:53.206Z","2.0.0":"2016-02-11T20:54:08.276Z","2.0.1":"2016-02-12T17:27:26.564Z","3.0.0":"2016-03-23T22:10:07.796Z","4.0.0":"2016-04-14T06:21:49.215Z","5.0.0":"2020-09-21T04:55:13.483Z"},"homepage":"https://github.com/hunterloftis/throng","keywords":["cluster","worker","process"],"repository":{"type":"git","url":"git+https://github.com/hunterloftis/throng.git"},"author":{"name":"Hunter Loftis","email":"hunter@hunterloftis.com"},"bugs":{"url":"https://github.com/hunterloftis/throng/issues"},"license":"MIT","readmeFilename":"readme.md","users":{"ramy":true,"justinshea":true,"wenbing":true,"gloddy":true,"bret":true,"paulj":true,"barenko":true,"nelix":true,"yeahoffline":true,"djordje":true,"rahman":true,"danieletassone":true,"pid":true,"slowmove":true,"reergymerej":true,"alfeo92":true,"yangwao":true,"jamesbedont":true,"lunelson":true,"oleg_tsyba":true,"ackhub":true,"bdelanghe":true,"lmangani":true,"bahreex":true,"bkmeneguello":true}}