Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #129 from stopal-r7/graceful_exit
Browse files Browse the repository at this point in the history
documentation and code fix for graceful exit
  • Loading branch information
StephenHynes7 committed Aug 30, 2016
2 parents a072dee + 9c846bc commit 2933d23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ to be sure any pending logs have finished writing.
```javascript
process.on('SIGINT', () => {
logger.notice({ type: 'server', event: 'shutdown' });
logger.once('buffer drain', () => process.exit());
logger.once('buffer drain', () => {
logger.end(() => {
setTimeout(() => {
process.exit(0);
}, 2000); // this delay gives sometime for the underlying connection to flush its queue
});
});
});
```

Expand Down
10 changes: 0 additions & 10 deletions src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,6 @@ class Logger extends Writable {
});
}

/**
* Stop reconnection along with its running connection(if any) and end the writable stream.
*/
end() {
// invoke disconnect of reconnection so any running connection
// will be destroyed and we will stop reconnecting.
this.reconnection.disconnect();
super.end(...arguments);
}

setDefaultEncoding() { /* no. */
}

Expand Down

0 comments on commit 2933d23

Please sign in to comment.