Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/winston-redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ Redis.prototype.stream = function (options) {
//Close Connection to redis Server
//Winston will call close function from clear/remove to attempt to cleanly exit.
Redis.prototype.close = function(){
if (this.redis)
this.redis.end();
};
if (this.redis) {
// Wait for 'drain' event from redis, else we might end the connection before the queue is empt
var rclient = this.redis;
rclient.on("drain", function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the drain event is never emitted?

// Use end(true) to allow internal draining
rclient.end(true);
});
}
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "winston-redis",
"description": "A fixed-length Redis transport for winston",
"version": "1.0.0",
"version": "1.0.1",
"author": "Charlie Robbins <[email protected]>",
"repository": {
"type": "git",
Expand All @@ -17,7 +17,7 @@
"dependencies": {
"async": "^1.2.1",
"lodash": "3.10.x",
"redis": "0.12.x"
"redis": "2.4.x"
},
"devDependencies": {
"winston": "^1.0.0",
Expand Down