Explorar el Código

enforce minimum size of 1k for compression

Brian Gough hace 11 años
padre
commit
36f60d5bce
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      services/document-updater/app/coffee/ZipManager.coffee

+ 2 - 1
services/document-updater/app/coffee/ZipManager.coffee

@@ -60,7 +60,8 @@ module.exports = ZipManager =
 			callback(null, result)
 			callback(null, result)
 
 
 	compressIfNeeded: (doc_id, text, callback) ->
 	compressIfNeeded: (doc_id, text, callback) ->
-		if ZIP_WRITES_ENABLED && ZIP_MINSIZE > 0 and text.length > ZIP_MINSIZE
+		if ZIP_WRITES_ENABLED and ZIP_MINSIZE > 1024 and text.length > ZIP_MINSIZE
+			# N.B. skip files of 1k or less, because gzip increases the size
 			zlib.gzip text, (err, buf) ->
 			zlib.gzip text, (err, buf) ->
 				if err?
 				if err?
 					logger.err doc_id:doc_id, err:err, "error compressing doc"
 					logger.err doc_id:doc_id, err:err, "error compressing doc"