package
Graceful exit when `uncaughtException` emit, base on `process.on('uncaughtException')`.
npm install gracefulGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Graceful exit when uncaughtException emit, base on process.on('uncaughtException').
It's the best way to handle uncaughtException on current situations.
npm install gracefulPlease see express_with_cluster example.
This below code just for dev demo, don't use it on production env:
const express = require('express');
const { graceful } = require('graceful');
const app = express()
.use()
.use(function(req, res){
if (Math.random() > 0.5) {
foo.bar();
}
setTimeout(function() {
if (Math.random() > 0.5) {
throw new Error('Asynchronous error from timeout');
} else {
If you have multi servers on one process, you just add them to server:
graceful({
servers: [server1, server2, restapi],
killTimeout: '15s',
});import { graceful } from 'graceful';Made with contributors-img.
Estimated unpacked size across 12 packages.
126.3 kB
Includes dependencies.