{"_id":"graceful","_rev":"1213009","name":"graceful","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"time":{"modified":"2021-10-13T05:46:37.000Z","created":"2013-04-12T10:09:03.719Z","1.0.2":"2018-10-31T02:28:55.236Z","1.0.1":"2016-06-23T15:54:38.903Z","1.0.0":"2014-11-05T04:11:45.016Z","0.1.0":"2014-05-29T06:32:57.782Z","0.0.6":"2014-02-17T06:17:45.012Z","0.0.5":"2013-04-18T09:32:36.921Z","0.0.4":"2013-04-18T08:52:36.900Z","0.0.3":"2013-04-14T06:48:25.930Z","0.0.2":"2013-04-14T05:31:32.181Z","0.0.1":"2013-04-12T10:09:03.719Z"},"users":{"chenllos":true,"ninozhang":true,"xuyuan923":true},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"type":"git","url":"git://github.com/node-modules/graceful.git"},"versions":{"1.0.2":{"name":"graceful","version":"1.0.2","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","scripts":{"test":"mocha -R spec -t 5000 test/*.test.js","test-cov":"istanbul cover _mocha -- -t 5000 test/*.test.js","lint":"jshint .","autod":"autod -w --prefix '^'"},"dependencies":{"humanize-ms":"^1.2.1","ps-tree":"^1.1.0"},"devDependencies":{"autod":"*","contributors":"^0.5.1","express":"^4.16.4","istanbul":"^0.4.5","jshint":"2","mocha":"^3.5.3","supertest":"^1.2.0"},"homepage":"https://github.com/node-modules/graceful","repository":{"type":"git","url":"git://github.com/node-modules/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"dead-horse","email":"dead_horse@qq.com","url":"https://github.com/dead-horse"}],"gitHead":"5e8c82345127f90470cee25e70d99dea0834f06a","bugs":{"url":"https://github.com/node-modules/graceful/issues"},"_id":"graceful@1.0.2","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"a7511b0d27e844036746c4ce8e4f1469c0fa2ea6","size":4229,"noattachment":false,"key":"/graceful/-/graceful-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-1.0.2.tgz"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/graceful_1.0.2_1540952935107_0.7920857358206965"},"_hasShrinkwrap":false,"publish_time":1540952935236,"_cnpm_publish_time":1540952935236},"1.0.1":{"name":"graceful","version":"1.0.1","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","files":["index.js"],"scripts":{"test":"mocha -R spec -t 5000 -r should test/*.test.js","test-cov":"istanbul cover _mocha -- -t 5000 -r should test/*.test.js","lint":"jshint .","autod":"autod -w --prefix '^'"},"dependencies":{"humanize-ms":"^1.2.0"},"devDependencies":{"autod":"*","contributors":"*","express":"4","istanbul":"*","jshint":"2","mocha":"*","should":"4","supertest":"1"},"homepage":"https://github.com/node-modules/graceful","repository":{"type":"git","url":"git://github.com/node-modules/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"dead-horse","email":"dead_horse@qq.com","url":"https://github.com/dead-horse"}],"gitHead":"d4fd865f9152c44f9678750947c13e0a7fc7e37a","bugs":{"url":"https://github.com/node-modules/graceful/issues"},"_id":"graceful@1.0.1","_shasum":"a7a62c8fffb3fab89b6d0d32f6e4074d32a1eeb2","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.5","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"a7a62c8fffb3fab89b6d0d32f6e4074d32a1eeb2","size":3887,"noattachment":false,"key":"/graceful/-/graceful-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-1.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/graceful-1.0.1.tgz_1466697276653_0.8272486007772386"},"directories":{},"publish_time":1466697278903,"_cnpm_publish_time":1466697278903,"_hasShrinkwrap":false},"1.0.0":{"name":"graceful","version":"1.0.0","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","scripts":{"test":"mocha --check-leaks -R spec -t 5000 -r should test/*.test.js","test-cov":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should test/*.test.js","test-travis":"node node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 -r should test/*.test.js","jshint":"jshint .","autod":"autod -w --prefix '~'","cnpm":"npm install --registry=https://registry.npm.taobao.org","contributors":"contributors -f plain -o AUTHORS"},"dependencies":{"humanize-ms":"~1.0.0"},"devDependencies":{"autod":"*","istanbul":"*","contributors":"*","express":"~4.10.1","mocha":"*","should":"~4.1.0","supertest":"~0.14.0"},"homepage":"https://github.com/node-modules/graceful","repository":{"type":"git","url":"git://github.com/node-modules/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.10.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"dead-horse","email":"dead_horse@qq.com","url":"https://github.com/dead-horse"}],"gitHead":"583260e1c05d5a84759575bc40b2f33db3357ff2","bugs":{"url":"https://github.com/node-modules/graceful/issues"},"_id":"graceful@1.0.0","_shasum":"c3abcabbb3adf0785abddce035d4fa72440dece6","_from":".","_npmVersion":"2.0.0","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"c3abcabbb3adf0785abddce035d4fa72440dece6","size":6450,"noattachment":false,"key":"/graceful/-/graceful-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-1.0.0.tgz"},"directories":{},"publish_time":1415160705016,"_cnpm_publish_time":1415160705016,"_hasShrinkwrap":false},"0.1.0":{"name":"graceful","version":"0.1.0","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","scripts":{},"dependencies":{},"devDependencies":{"autod":"*","blanket":"*","connect":"~2.17.3","contributors":"*","coveralls":"*","mocha":"*","mocha-lcov-reporter":"*","should":"~3.3.2","supertest":"~0.13.0","travis-cov":"*"},"homepage":"https://github.com/fengmk2/graceful","repository":{"type":"git","url":"git://github.com/fengmk2/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.8.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"dead-horse","email":"dead_horse@qq.com","url":"https://github.com/dead-horse"}],"gitHead":"681c29578bad0fe33b6e383bb9ba2af2992153a0","bugs":{"url":"https://github.com/fengmk2/graceful/issues"},"_id":"graceful@0.1.0","_shasum":"8d7617f183ce4cdbdf56ce46fa7f46c66a264fdd","_from":".","_npmVersion":"1.4.13","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"8d7617f183ce4cdbdf56ce46fa7f46c66a264fdd","size":5780,"noattachment":false,"key":"/graceful/-/graceful-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-0.1.0.tgz"},"directories":{},"publish_time":1401345177782,"_cnpm_publish_time":1401345177782,"_hasShrinkwrap":false},"0.0.6":{"name":"graceful","version":"0.0.6","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","scripts":{},"dependencies":{},"devDependencies":{"autod":"*","blanket":"*","connect":"2.13.0","contributors":"*","coveralls":"*","mocha":"*","mocha-lcov-reporter":"*","should":"3.1.2","supertest":"0.9.0","travis-cov":"*"},"homepage":"https://github.com/fengmk2/graceful","repository":{"type":"git","url":"git://github.com/fengmk2/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.8.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"fengmk2@gmail.com","url":"https://github.com/fengmk2"},{"name":"dead-horse","email":"dead_horse@qq.com","url":"https://github.com/dead-horse"}],"bugs":{"url":"https://github.com/fengmk2/graceful/issues"},"_id":"graceful@0.0.6","dist":{"shasum":"e90e0834a7c98223396ae3c3d4d03fae663ef172","size":5664,"noattachment":false,"key":"/graceful/-/graceful-0.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-0.0.6.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{},"publish_time":1392617865012,"_cnpm_publish_time":1392617865012,"_hasShrinkwrap":false},"0.0.5":{"name":"graceful","version":"0.0.5","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"connect":"*","should":"*","supertest":"*","jscover":"*","mocha":"*"},"repository":{"type":"git","url":"git://github.com/fengmk2/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.8.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","readmeFilename":"README.md","_id":"graceful@0.0.5","dist":{"shasum":"faba06d837365e9e336912042309cfb611262b99","size":5302,"noattachment":false,"key":"/graceful/-/graceful-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-0.0.5.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{},"publish_time":1366277556921,"_cnpm_publish_time":1366277556921,"_hasShrinkwrap":false},"0.0.4":{"name":"graceful","version":"0.0.4","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"connect":"*","should":"*","supertest":"*","jscover":"*","mocha":"*"},"repository":{"type":"git","url":"git://github.com/fengmk2/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.8.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","readmeFilename":"README.md","_id":"graceful@0.0.4","dist":{"shasum":"a4c7ec0beb4915c75c48c5b05f94afafc00cb98d","size":5262,"noattachment":false,"key":"/graceful/-/graceful-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-0.0.4.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{},"publish_time":1366275156900,"_cnpm_publish_time":1366275156900,"_hasShrinkwrap":false},"0.0.3":{"name":"graceful","version":"0.0.3","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"connect":"*","should":"*","supertest":"*","jscover":"*","mocha":"*"},"repository":{"type":"git","url":"git://github.com/fengmk2/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.8.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","readmeFilename":"README.md","_id":"graceful@0.0.3","dist":{"shasum":"6c20ca0a6ccf694c3aa726f20d5137f4e981f12d","size":4941,"noattachment":false,"key":"/graceful/-/graceful-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-0.0.3.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{},"publish_time":1365922105930,"_cnpm_publish_time":1365922105930,"_hasShrinkwrap":false},"0.0.2":{"name":"graceful","version":"0.0.2","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"connect":"*","should":"*","supertest":"*","jscover":"*","mocha":"*"},"repository":{"type":"git","url":"git://github.com/fengmk2/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.8.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","readmeFilename":"README.md","_id":"graceful@0.0.2","dist":{"shasum":"6ca337748acd33788caeecde810171faf606f91e","size":4736,"noattachment":false,"key":"/graceful/-/graceful-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-0.0.2.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{},"publish_time":1365917492181,"_cnpm_publish_time":1365917492181,"_hasShrinkwrap":false},"0.0.1":{"name":"graceful","version":"0.0.1","description":"Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.","main":"index.js","scripts":{"test":"make test"},"dependencies":{},"devDependencies":{"connect":"*","should":"*","supertest":"*","jscover":"*","mocha":"*"},"repository":{"type":"git","url":"git://github.com/fengmk2/graceful.git"},"keywords":["graceful","uncaught","uncaughtException","error","graceful","cluster","graceful exit"],"engines":{"node":">= 0.8.0"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","readmeFilename":"README.md","_id":"graceful@0.0.1","dist":{"shasum":"acab76237f734240cdd44eae333877a3e8c109d6","size":4573,"noattachment":false,"key":"/graceful/-/graceful-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/graceful/download/graceful-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{},"publish_time":1365761343719,"_cnpm_publish_time":1365761343719,"_hasShrinkwrap":false}},"readme":"# graceful\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][cov-image]][cov-url]\n[![David deps][david-image]][david-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/graceful.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/graceful\n[travis-image]: https://img.shields.io/travis/node-modules/graceful.svg?style=flat-square\n[travis-url]: https://travis-ci.org/node-modules/graceful\n[cov-image]: https://codecov.io/github/node-modules/cfork/coverage.svg?branch=master\n[cov-url]: https://codecov.io/github/node-modules/cfork?branch=master\n[david-image]: https://img.shields.io/david/node-modules/cfork.svg?style=flat-square\n[david-url]: https://david-dm.org/node-modules/cfork\n[download-image]: https://img.shields.io/npm/dm/graceful.svg?style=flat-square\n[download-url]: https://npmjs.org/package/graceful\n\n\nGraceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.\n\n## Why we should use this module\n\nIt's the best way to handle `uncaughtException` on current situations.\n\n* [domain failure](https://github.com/fengmk2/domain-middleware/blob/master/example/failure.js).\n* [Node.js 异步异常的处理与domain模块解析](http://deadhorse.me/nodejs/2013/04/13/exception_and_domain.html)\n\n## Install\n\n```bash\n$ npm install graceful\n```\n\n## Usage\n\nPlease see [connect_with_cluster](https://github.com/fengmk2/graceful/tree/master/example/connect_with_cluster) example.\n\nThis below code just for dev demo, don't use it on production env:\n\n```js\nvar express = require('express');\nvar graceful = require('graceful');\n\nvar app = express()\n.use()\n.use(function(req, res){\n  if (Math.random() > 0.5) {\n    foo.bar();\n  }\n  setTimeout(function() {\n    if (Math.random() > 0.5) {\n      throw new Error('Asynchronous error from timeout');\n    } else {\n      res.end('Hello from Connect!');\n    }\n  }, 100);\n  setTimeout(function() {\n    if (Math.random() > 0.5) {\n      throw new Error('Mock second error');\n    }\n  }, 200);\n})\n.use(function(err, req, res, next) {\n  res.end(err.message);\n});\n\nvar server = app.listen(1984);\n\ngraceful({\n  servers: [server],\n  killTimeout: '30s',\n});\n```\n\nIf you have multi servers on one process, you just add them to `server`:\n\n```js\ngraceful({\n  servers: [server1, server2, restapi],\n  killTimeout: '15s',\n});\n```\n\nIf you are using [pm](https://github.com/aleafs/pm),\nyou can follow the [graceful_exit with pm demo](https://github.com/aleafs/pm/tree/master/demo/graceful_exit).\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2013 - 2014 fengmk2 &lt;fengmk2@gmail.com&gt;\nCopyright (c) 2015 - 2016 node-modules and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/node-modules/graceful","bugs":{"url":"https://github.com/node-modules/graceful/issues"},"license":"MIT"}