{"_id":"forky","_rev":"31-42f95e30b68c3f39013ed3f85846efbd","name":"forky","description":"node-forky ==========","dist-tags":{"latest":"1.2.0"},"versions":{"0.0.1":{"name":"forky","version":"0.0.1","description":"ERROR: No README.md file found!","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"keywords":["cluster","pre-fork"],"author":{"name":"Brian M. Carlson"},"license":"MIT","bugs":{"url":"https://github.com/brianc/node-forky/issues"},"devDependencies":{"okay":"~0.3.0","mocha":"~1.12.0","express":"~3.3.4","request":"~2.25.0","async":"~0.2.9","sliced":"0.0.5","express-domain-middleware":"~0.1.0"},"_id":"forky@0.0.1","dist":{"shasum":"e461545317da85d46a2fd26873b7bc171c323598","tarball":"https://registry.npmjs.org/forky/-/forky-0.0.1.tgz","integrity":"sha512-ryNDaH4ZOtbzzgPrf3Cie8rQvdThDITy1+IeC94USanK82IRjG31h+nbrRPRHAHHen82KQdTRc3t+wgA/xxjIg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF2VIe1X87r8LLnkxd9n/HZooetg94tWU5uOMxIzU0MYAiABBQSpHAPW9TaiOSVjhphmiP2TcgfWRFWUNOJh2Os7hg=="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"directories":{}},"0.0.2":{"name":"forky","version":"0.0.2","description":"node-forky ==========","main":"index.js","scripts":{"test":"make"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"keywords":["cluster","pre-fork"],"author":{"name":"Brian M. Carlson"},"license":"MIT","bugs":{"url":"https://github.com/brianc/node-forky/issues"},"devDependencies":{"okay":"~0.3.0","mocha":"~1.12.0","express":"~3.3.4","request":"~2.25.0","async":"~0.2.9","sliced":"0.0.5","express-domain-middleware":"~0.1.0"},"_id":"forky@0.0.2","dist":{"shasum":"4f84843188a34296e486c44d7bd867db8e32acc5","tarball":"https://registry.npmjs.org/forky/-/forky-0.0.2.tgz","integrity":"sha512-6deTqY6kB8aM1cXK6WT+zQQnBiH/3KyMWs3m8A+j7VLbV0pFkPMEj1EuySegSKqjh32TdGNfWmEoIV1GKp9l9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQChmwXDRzl7+zf8RiGmY8Okz0gTqUTXtRfbvZWt2zfDBQIgFAkun+CPhAnYksvtfh81gNbidwSXesyujxrVhrZOnHk="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"directories":{}},"0.1.0":{"name":"forky","version":"0.1.0","description":"node-forky ==========","main":"index.js","scripts":{"test":"make"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"keywords":["cluster","pre-fork"],"author":{"name":"Brian M. Carlson"},"license":"MIT","bugs":{"url":"https://github.com/brianc/node-forky/issues"},"devDependencies":{"okay":"~0.3.0","mocha":"~1.12.0","express":"~3.3.4","request":"~2.25.0","async":"~0.2.9","sliced":"0.0.5","express-domain-middleware":"~0.1.0"},"homepage":"https://github.com/brianc/node-forky","_id":"forky@0.1.0","dist":{"shasum":"9f4c8a5a884d4d5c8e0c4502ee72216a2c69da63","tarball":"https://registry.npmjs.org/forky/-/forky-0.1.0.tgz","integrity":"sha512-EklmZR9sqHU+PsofOxfd3xmmPYlOl7fLtMdUqvgN0z/A6hq4yUuj03u5wuRed9iAYnepOCYoDrl5pk4wpI3WLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDz8oHpEvFpYrY6ATYtyAb1SKmTXOmtjQIR+FT0XwXdnQIgZRTGoHRtoiCgkaQRjGo7KJded+xVfOvfuJpKuU1a5IM="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"directories":{}},"0.1.1":{"name":"forky","version":"0.1.1","description":"node-forky ==========","main":"index.js","scripts":{"test":"make"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"keywords":["cluster","pre-fork"],"author":{"name":"Brian M. Carlson"},"license":"MIT","bugs":{"url":"https://github.com/brianc/node-forky/issues"},"devDependencies":{"okay":"~0.3.0","mocha":"~1.12.0","express":"~3.3.4","request":"~2.25.0","async":"~0.2.9","sliced":"0.0.5","express-domain-middleware":"~0.1.0"},"homepage":"https://github.com/brianc/node-forky","_id":"forky@0.1.1","dist":{"shasum":"7b8bf2f984f6319d2d07cf09c857a2fc2ff1ee7b","tarball":"https://registry.npmjs.org/forky/-/forky-0.1.1.tgz","integrity":"sha512-7q0m2N3852ZoxJ7ubj2nBlG8gKMxYmg0QZi5ZbM/Unowo+BORWb565nxhblVNPAdtRy07ATsrcFrvKtO3Md/bw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCECAffdAikXTQ5Hz2S+cfU8ct/+O61CrMh7DY1k1I0TAIhAJm7bMnkS7I0Kk4IczdYzZffNErh7XMt/5sK84hPQBXX"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"directories":{}},"0.1.2":{"name":"forky","version":"0.1.2","description":"node-forky ==========","main":"index.js","scripts":{"test":"make"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"keywords":["cluster","pre-fork"],"author":{"name":"Brian M. Carlson"},"license":"MIT","bugs":{"url":"https://github.com/brianc/node-forky/issues"},"devDependencies":{"okay":"~0.3.0","mocha":"~1.12.0","express":"~3.3.4","request":"~2.25.0","async":"~0.2.9","sliced":"0.0.5","express-domain-middleware":"~0.1.0"},"homepage":"https://github.com/brianc/node-forky","_id":"forky@0.1.2","dist":{"shasum":"41ca0a406b41f1d198d1ec4160e32a589bc70bc7","tarball":"https://registry.npmjs.org/forky/-/forky-0.1.2.tgz","integrity":"sha512-sBaepjIfPrXBdk9LV0TP6SwCwyWuDno5BPY+Rp5u2PLAVR+TLaRCCkJrqabC4F9UfYLFhpw0rEySVeppS+DkoA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIES5lZ20sv5/G+Ki2VgeZOVNBri/8M42QkdWZhmjlK+JAiEAoNvOUEIUm2Hsw4HmForPFWo8nb2age5LQPjl7h/CSBw="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"directories":{}},"0.3.0":{"name":"forky","version":"0.3.0","description":"node-forky ==========","main":"index.js","scripts":{"test":"make"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"keywords":["cluster","pre-fork"],"author":{"name":"Brian M. Carlson"},"license":"MIT","bugs":{"url":"https://github.com/brianc/node-forky/issues"},"devDependencies":{"okay":"~0.3.0","mocha":"~1.12.0","express":"~3.3.4","request":"~2.25.0","async":"~0.2.9","sliced":"0.0.5","express-domain-middleware":"~0.1.0"},"gitHead":"6fe4d0e448535831b30b9210cd5b06f750453e78","homepage":"https://github.com/brianc/node-forky","_id":"forky@0.3.0","_shasum":"d2b0fa9e489413936550773f15ed57950e2e08dd","_from":".","_npmVersion":"2.0.0","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"dist":{"shasum":"d2b0fa9e489413936550773f15ed57950e2e08dd","tarball":"https://registry.npmjs.org/forky/-/forky-0.3.0.tgz","integrity":"sha512-FKDB0mnuhgRaMz/E2+EYUiL5sSlkb8dUyHt0rUZis0R2qSqo1tfXfQCukZJORKuXQsRMoq6Vwg+6ionZafjvKA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGR2sFB1jh229l33fFFD8PE9DjDaGACZnbK8nA7dc3fTAiAxxzFzK5qzNJOxyQ3F7r9rWlPYFXwke57a2O48/gm85Q=="}]},"directories":{}},"1.0.0":{"name":"forky","version":"1.0.0","description":"node-forky ==========","main":"index.js","engines":{"node":">=8.0"},"scripts":{"test":"make"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"keywords":["cluster","pre-fork"],"author":{"name":"Brian M. Carlson"},"license":"MIT","bugs":{"url":"https://github.com/brianc/node-forky/issues"},"devDependencies":{"async":"^2.6.1","express":"^4.16.3","request":"^2.87.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"gitHead":"f255746eabbb3477b8b5390e3c31cac8a5242e1e","homepage":"https://github.com/brianc/node-forky#readme","_id":"forky@1.0.0","_npmVersion":"6.1.0","_nodeVersion":"10.6.0","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"dist":{"integrity":"sha512-VCCOzEFE24baXKyn5lMODu697v6qCTRNnOF2Ay2RsscCrEwqz7QBn/zNubPUyF+LAPmPdKc2XAVRdVhBUwXy9w==","shasum":"b8f1ad1de571ff0dad02dbe198ebd1a0e61d0a5e","tarball":"https://registry.npmjs.org/forky/-/forky-1.0.0.tgz","fileCount":17,"unpackedSize":19389,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbR8rxCRA9TVsSAnZWagAA1EkP/RKGxCsXfeDbnoLkTSts\nXbkEbaF6B9bFLRpr+65Xl04+NsPpdQgrM2VXnNMHQ6OyMIvPAwsgQEADi408\nWbN0LroICDsmgzFpLHf+1Djg6Tv3lrCtliOfTfd8UTcAk8nHCiYdXLmoKfYe\nPj8SwT5sb4KPBH9LxRACK8FtEZ8/ZGldjtD289pBmAw+V/6c1vrqW8OW62MN\nOUVN92XV9BncQa1nzP3BbjKmefcxjHf+UUM3qevVeLSu6fbo1f9ZwcUQ0Sk9\nYE5Yx46H65P5B1Qy8/CgzMcApREdq/JBED8cH7leGaB7IZ2EvfqTeXHEnyf7\ndX4ldWsYEI3gBPrnR31nCPfOzZrONQaAwNbOR32L08xEF3ovATdTkXjdBJQQ\nPmm9/beh9Bzx8ptFpxU67EzUgckZQlJlSTJWjC7BSbl7RvYW2VWFbHS/FzRZ\nm4rc2lhAYIth9G38aKnx8JQL2Y9aMPutVQ6Grg/uH/5mgxpL8l631Hxs4UOI\nawZ0zMk85eJtZ1myDqpPoMIk7fYJmO/GO1l0/bZp10A4c8JdO54FG7vW19Pl\nH/Zl1xEEPAuoRRiekmlMWSjsjeqmm9m0RkaZFRzPh72CQcU81fi+g+LfACNY\naBrvBwoO3Q2SwskUOE1Ophocr5/gOKO7D4AtlooYodX18s1yB2/D+ndFUSxl\n20Qp\r\n=3698\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpo4T3gc+gmke28d/1pXKMbnrXZpK9HGFlGG/0jSBZFQIhAKx3RGo22hRhchzxonkaASOzVogNts7cUzfl0y+PgcaZ"}]},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/forky_1.0.0_1531431665573_0.397411203697172"},"_hasShrinkwrap":false},"1.1.0":{"name":"forky","version":"1.1.0","description":"node-forky ==========","main":"index.js","engines":{"node":">=8.0"},"scripts":{"test":"make"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"keywords":["cluster","pre-fork"],"author":{"name":"Brian M. Carlson"},"license":"MIT","bugs":{"url":"https://github.com/brianc/node-forky/issues"},"devDependencies":{"async":"^2.6.1","express":"^4.16.3","request":"^2.87.0"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"gitHead":"e4d41dbfb7a870641b333ed5c758756ba8f0e97f","homepage":"https://github.com/brianc/node-forky#readme","_id":"forky@1.1.0","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"dist":{"integrity":"sha512-Osj0Pzy1lxKtl2qF22BuGyfgg3QY6s3M5Cy3N3y4S9QX5UqWAoQCDvGy48AC30i6gx426pN+i6ZP8S3g0bwpvA==","shasum":"b0d0082f73cc018503ef634f11311673cfbc2f99","tarball":"https://registry.npmjs.org/forky/-/forky-1.1.0.tgz","fileCount":17,"unpackedSize":19573,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtPAUCRA9TVsSAnZWagAA4SAP/0H8GKC6Hjg7Zipu+EDc\nW0MgudLhsOMiz1O3xjgii9PicMBWl+3jQ9OiKh+NMCPVTmJ2C+ohZO4iGwyJ\no5VHace9iJa8uk0vFyoLpX2G64Qv/Oo33jZ8clj74CnCJk6Bcz7LqxCWlCgC\n0S/NLPsZGIOJI+D5+If9G+ylHjg3TRDlFQdazsUAs5I42bOYtSy1+A2TLw34\nKat1FYVfe7EA+tglxG8waAus/6j1p+6KZERAbmgdm+sqEznIPrUZ/fyFTd79\n8Sc6xA3Y62E3a8RXxZHFYJ8M9X5a8418BNwenrRMcFY81YjyzOfOBv4iVJ2d\nSBihYdWCZUhJ/WIydgs3gV2kxa+8IfLM2EgXpu5UqEJC9+QRPtsKSY9AYMCK\nNZVegnr5UIANiOurQvllLWyBmbUuBOpNL8LZpkS9P622PCOrqEtmHSz6rthB\nTTg2p+RfnvFG9FHXVd8xlxkgdHhcz+JLpBGGyoo3yxVWLWC+NPcp5a2dn+J5\n78NdYfhdxAutHP35Ra5u+yb9ng2BSDpAqDXVSqeee81tKoXXe1jPo+Zi0Fo+\n4ogj9CdcdiIiZBdLlLPAzO63n8TGZj3qd8xfaelMSVrngqBKK4H33i1ULP9H\n2aUyD4AFw64p9G/5gcQOgOX3we0k/P9uP7Be+2gzn9VqQVyFBbby4NfneDGu\nNBGI\r\n=e6Ou\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDz8ymilUjGP95qBSjwwh4BcqhaqnNwoLJUGvDSyrAd2QIgFrGW9ylArSS/6IRoAibtY+X3iePrirqb6n42whfY3r8="}]},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/forky_1.1.0_1538584595562_0.6576367619042971"},"_hasShrinkwrap":false},"1.2.0":{"name":"forky","version":"1.2.0","description":"node-forky ==========","main":"index.js","types":"index.d.ts","engines":{"node":">=8.0"},"scripts":{"test":"make"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"keywords":["cluster","pre-fork"],"author":{"name":"Brian M. Carlson"},"license":"MIT","bugs":{"url":"https://github.com/brianc/node-forky/issues"},"devDependencies":{"async":"^3.1.1","express":"^4.17.1","request":"^2.88.2"},"prettier":{"printWidth":120,"semi":false,"singleQuote":true,"trailingComma":"es5"},"gitHead":"b3238f3bb744a971418a0950c8baea3b617d6c55","homepage":"https://github.com/brianc/node-forky#readme","_id":"forky@1.2.0","_nodeVersion":"10.16.3","_npmVersion":"6.13.4","dist":{"integrity":"sha512-jLiVjku57BNsq+D6gT9yWXiKC6/Y8p9DDObrlDLWmQDZfjzDkBMfHXz6LiaE01TVroULYvYjdb7kOKaaArVSoQ==","shasum":"970a47169b89d711c1b367e5d3ae79830d28d3dd","tarball":"https://registry.npmjs.org/forky/-/forky-1.2.0.tgz","fileCount":4,"unpackedSize":11434,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeTcv9CRA9TVsSAnZWagAAhjQP/1LUa726yiivO3TRGOyP\nY/mfUXk3hNkunnLZC1uj9NUfZWQvVYKNoshytxleDUyg37yBy9AzMBqzyCr1\nBaOo189uOSnRS17GUtfQz2y9A9dWZGDgvP7i+avBTI/e3VTlo3c2IHF01Hqf\nKmum2fRN/dOCGFgwZdTdCbTujibextESzWpfmSwKp/SXZ6RmIZ36cX/WNVAO\nHdZjEtrcZqImf07i3obkAsaC2NPms5ggI0kDMYNrANZxGEOj53DnjHuecyRA\n+m7Bd9OgdYQeqdDmMBHjWr5uf5RwNQb+pzsHRNTmggzohgAnrvhJxyzciNgq\nYv6nRhBk5KN2fNUXNSzIztTg6QCIYgFaLGCr7Jcv38NwWGQrCLci3W+ebKmo\nXqaFVPiuzUBSeRhJcOa/HXimUBIYTJ66e4lyW8MKDc//dynJa5bdbXLfpjFH\neP/apfHrW8XaiQ/Pc6tVDt+ONw2fqthAwWuhTToeR3L3HRo0N+IfjltB8cKI\nMQaKlvtGeinbIIRaY5rs9LvajOiqGrxOtUCt2pGPkBwFGMbuPNcnUsO9UAN/\nrrZV9hY9trKrDdZmQNtQRS8rXbXKki1bGa7MSS4QZbgiV7I3pUyl7ZhjCDR+\ndrdVuT39n4fh04y7Yj94ou+LLxJOicL2mOu22TCnGYMhd1sQrpG6KgQxYp1p\ncvl1\r\n=NujS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+DAaV9b7GdaNTucuS9MH227xfZ4QSOP1ozCJLS//O8AIgUxfDPAKBp5m+6LblvKhhqEtCRGasGWMI6yvL7BnJ4cE="}]},"maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"_npmUser":{"name":"brianc","email":"brian.m.carlson@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/forky_1.2.0_1582156797011_0.030421004560229337"},"_hasShrinkwrap":false}},"readme":"node-forky\n==========\n\n[![Build Status](https://travis-ci.org/brianc/node-forky.svg?branch=master)](https://travis-ci.org/brianc/node-forky)\n\nForky makes using the cluster module easier without preventing you from using it directly.\n\n__Problem__: using `require('cluster')` properly is difficult, error prone, and hard to test.  \n__Solution__: \n\n\n__master.js__\n```js\nvar forky = require('forky');\nforky({path: __dirname + '/worker.js'});\n```\n\n__worker.js__\n```js\nvar http = require('http');\nhttp.createServer(function(req, res) {\n  res.writeHead(200, {'content-type': 'text/html'});\n  res.end('Hello from worker ' + require('cluster').worker.id);\n});\n```\n\n__bash__\n```bash\n$ node master\n```\n\n##### For a more complete example please check out the [detailed example implementation](https://github.com/brianc/node-forky/tree/master/examples)\n\n## installation\n\n`npm install forky`\n\n## usage\n\nForky is meant to work with your existing http server without modifying the server.  \nTo take advantage of a multi-core system create a new file called `master.js` and require forky:\n\n__master.js__\n```js\nvar forky = require('forky');\n```\n\nOnce this file is created, call forky by passing it the file path to your existing http server or your old _entry point_ to your application.\n\n_example: if you used to type `node index.js` to start your application, your master.js file should look like this_\n\n__master.js__\n```js\nvar forky = require('forky');\nforky({path: __dirname + '/index.js'});\n```\n\nWhat forky will do is spawn a number of workers equal to the number of cores you have available on your system.  \nIf one of these workers disconnects for __any reason__ due to a process.uncaughtException or even a `kill -9 <pid>` to the worker process, forky will spawn a new worker immedately.  \nAfter forky has spawned a new worker it will attempt to gracefully shut down your disconnected worker.  After a timeout if your disconnected worker is still running, forky will forcefully kill it.\n\n\nThe best way to handle unexpected errors in node is to shut down your process and spawn a new one. Forky makes clean process shutdown & respawn easy as pie.\n\nLet's implement an http server in node that throws an uncatchable exception.\n\n__index.js__\n```js\nvar http = require('http');\nhttp.createServer(function(req, res) {\n  res.writeHead(200, {'content-type': 'text/html'});\n  res.end('everything is groovy');\n  setTimeout(function() {\n    throw new Error(\"This will crash your node process\");\n  }, 1000);\n});\n```\n\nNow if someone hits our server, 1 second later the server will crash. The easy __but wrong__ way to handle this is by adding a `process.on('uncaughtException')` handler and just keep going forward as if nothing has happend:\n\n__index.js__\n```js\nvar http = require('http');\nhttp.createServer(function(req, res) {\n  res.writeHead(200, {'content-type': 'text/html'});\n  res.end('everything is groovy');\n  setTimeout(function() {\n    throw new Error(\"This will crash your node process\");\n  }, 1000);\n});\n\nprocess.on('uncaughtException', function(err) {\n  //log the error\n  console.error(err);\n  //continue on as if nothing has happend...\n  //but something HAS happened.  What if the error wasn't in a timeout?\n  //what if our error came from somewhere deep down and left some dangling\n  //uncloses sockets or connections to database or open files?  We could be leaking\n  //resources slowly and not even know it. oh no!\n});\n```\n\nInstead of doing that let's use our `master.js` file we created above and modify our worker to _gracefully disconnect_ to cleanup the problems caused by the unexpected error:\n\n\n__index.js__\n```js\nvar http = require('http');\nhttp.createServer(function(req, res) {\n  res.writeHead(200, {'content-type': 'text/html'});\n  res.end('everything is groovy');\n  setTimeout(function() {\n    throw new Error(\"This will crash your node process\");\n  }, 1000);\n});\n\nprocess.on('uncaughtException', function(err) {\n  //log the error\n  console.error(err);\n  //let's tell our master we need to be disconnected\n  require('forky').disconnect();\n  //in a worker process, this will signal the master that something is wrong\n  //the master will immediately spawn a new worker\n  //and the master will disconnect our server, allowing all existing traffic to end naturally\n  //but not allowing this process to accept any new traffic\n});\n```\n\nAll of the above is to help with graceful shutdowns.  Forky doesn't actually need you to signal disconnect from your workers. You can just let the exception crash the process, you can call `process.exit()`, or do anything else you want to clean up. Once your worker closes, regardless of the reason, forky will spawn a new one.\n\n### Options\n\ncan take several options in addition to the file path:\n\n* `path` - The path to the file to launcher for workers\n* `workers` - The number of workers to launch (default: the number of cores)\n* `callback` - A callback to call when forky has launched the workers\n* `enable_logging` - Whether to enable forky logging (default: `false`)\n* `kill_timeout` - The kill timeout (milliseconds) to use if a worker does not kill shutdown properly and is not given a timeout when it is told to disconnect (default: `1000`)\n* `scheduling_policy` - The scheduling policy to use for cluster.\n\n## Contributing\n\nI love contributions.  If you'd like to contribute a bug fix, send in yer pull requests!  \n\nIf you want to add a more substantial feature open an issue, and let's discuss it. We can turn that issue into a pull request and get new features added. Open Source Is Awesome. :+1:\n\nDue to the race-condition type nature of managing a cluster of workers the tests don't use a test framework, they just batter the hell out of the example server and make sure it never returns an unexpected result.  To run the tests just type `make` after cloning & doing an `npm install`\n## License\n\nCopyright (c) 2013 Brian M. Carlson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","maintainers":[{"name":"brianc","email":"brian.m.carlson@gmail.com"}],"time":{"modified":"2022-06-18T03:00:12.572Z","created":"2013-08-05T23:06:32.107Z","0.0.1":"2013-08-05T23:06:32.406Z","0.0.2":"2013-09-05T22:50:03.818Z","0.1.0":"2014-04-04T13:53:31.479Z","0.1.1":"2014-05-08T16:46:06.498Z","0.1.2":"2014-05-08T17:24:07.765Z","0.3.0":"2015-02-21T16:38:11.241Z","1.0.0":"2018-07-12T21:41:05.723Z","1.1.0":"2018-10-03T16:36:35.643Z","1.2.0":"2020-02-19T23:59:57.121Z"},"author":{"name":"Brian M. Carlson"},"repository":{"type":"git","url":"git://github.com/brianc/node-forky.git"},"homepage":"https://github.com/brianc/node-forky#readme","keywords":["cluster","pre-fork"],"bugs":{"url":"https://github.com/brianc/node-forky/issues"},"license":"MIT","readmeFilename":"README.md","users":{"bret":true,"barenko":true,"ninozhang":true,"rahman":true,"pid":true,"pdedkov":true,"lunelson":true,"ackhub":true,"bdelanghe":true,"bahreex":true}}