Fix YLT freezing the queue when an incorrect gzip header is sent on a file
This commit is contained in:
@@ -121,7 +121,7 @@ var FileMinifier = function() {
|
||||
});
|
||||
|
||||
} else {
|
||||
debug('Not minfiable type or already minified');
|
||||
debug('Not minifiable type or already minified');
|
||||
deferred.resolve(entry);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ var zlib = require('zlib');
|
||||
var GzipCompressor = function() {
|
||||
|
||||
function compressFile(entry) {
|
||||
debug('Entering compressFile');
|
||||
return gzipUncompressedFile(entry)
|
||||
|
||||
.then(gzipOptimizedFile);
|
||||
@@ -41,7 +42,7 @@ var GzipCompressor = function() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
debug('Compression not needed');
|
||||
deferred.resolve(entry);
|
||||
}
|
||||
|
||||
@@ -73,6 +74,7 @@ var GzipCompressor = function() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
debug('Compressing optimized file not needed');
|
||||
deferred.resolve(entry);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ var WeightChecker = function() {
|
||||
.then(gzipCompressor.compressFile)
|
||||
|
||||
.then(function(newEntry) {
|
||||
debug('File %s - Redownloaded, optimized, minified, compressed: done', entry.url);
|
||||
callback(null, newEntry);
|
||||
})
|
||||
|
||||
@@ -439,7 +440,9 @@ var WeightChecker = function() {
|
||||
isCompressed = true;
|
||||
tally();
|
||||
}).on('error', function(err) {
|
||||
debug('Error while decoding %s', requestOptions.url);
|
||||
debug(err);
|
||||
callback(err);
|
||||
});
|
||||
|
||||
res.on('data', function (data) {
|
||||
@@ -459,7 +462,9 @@ var WeightChecker = function() {
|
||||
isCompressed = true;
|
||||
tally();
|
||||
}).on('error', function(err) {
|
||||
debug('Error while decoding %s', requestOptions.url);
|
||||
debug(err);
|
||||
callback(err);
|
||||
});
|
||||
|
||||
res.on('data', function (data) {
|
||||
@@ -489,6 +494,8 @@ var WeightChecker = function() {
|
||||
})
|
||||
|
||||
.on('error', function(err) {
|
||||
debug('Error while downloading %s', requestOptions.url);
|
||||
debug(err);
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user