Skip to content

Commit

Permalink
Merge commit '4a97dbc8f67f734d116c8b8cd4d47297c17c0b33'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rcomian committed May 9, 2021
2 parents 85666ea + 4a97dbc commit f2bfc33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/filerotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ function FileRotator(logpath, totalFiles, totalSize, gzip) {
})
.pipe(zlib.createGzip())
.pipe(fs.createWriteStream(zippedPath))
.on('finish', function () {
fs.unlink(unzippedPath, next);
.on('close', function () {
fs.unlink(unzippedPath, () => {
base.emit('gzip_finish', zippedPath);
next();
});

})
}

Expand Down
3 changes: 3 additions & 0 deletions lib/rotatingfilestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function RotatingFileStream(options) {
var shared = options.shared;

var rotator = FileRotator(path, totalFiles, totalSize, gzip);
rotator.on('gzip_finish', function(zippedPath) {
base.emit('gzip_finish', zippedPath);
});

var stream = null;
var streambytesWritten = 0;
Expand Down

0 comments on commit f2bfc33

Please sign in to comment.