From dd439d5ec364e8600eaeb806908929fb8d8323b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sat, 30 Jan 2021 23:55:28 +0000 Subject: [PATCH] Don't try to convert huge fonts to woff2, otherwise the server freezes for too long --- lib/tools/redownload/fontAnalyzer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/tools/redownload/fontAnalyzer.js b/lib/tools/redownload/fontAnalyzer.js index a5bad4e..5efc5f8 100644 --- a/lib/tools/redownload/fontAnalyzer.js +++ b/lib/tools/redownload/fontAnalyzer.js @@ -55,6 +55,12 @@ var FontAnalyzer = function() { debug('File is already a woff2.'); deferred.resolve(entry); + } else if (fileSize > 1024 * 1024) { + + // Don't try to convert huge font files, it would block the server for several minutes + debug('Font is too big, skipping conversion.'); + deferred.resolve(entry); + } else if (entry.isWoff) { debug('File is a woff. Let\'s convert to woff2'); @@ -67,7 +73,7 @@ var FontAnalyzer = function() { woff2 = ttf2woff2(ttf); newFileSize = woff2.length; - debug('New image size is %d', newFileSize); + debug('New font size is %d', newFileSize); debug('Filesize is %d bytes smaller (-%d%)', fileSize - newFileSize, Math.round((fileSize - newFileSize) * 100 / fileSize)); entry.weightCheck.sizeAsWoff2 = newFileSize;