From ff69b3f61771ccc3f0a70d91876cb89059e1f035 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 16 Sep 2021 13:56:14 +0200 Subject: [PATCH] allow process to exist and cancel timeout again --- lib/cache/PackFileCacheStrategy.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/cache/PackFileCacheStrategy.js b/lib/cache/PackFileCacheStrategy.js index cd6fd1da091..d940689f7e9 100644 --- a/lib/cache/PackFileCacheStrategy.js +++ b/lib/cache/PackFileCacheStrategy.js @@ -118,6 +118,14 @@ class Pack { this.requests.push(undefined); this.requestsTimeout = undefined; }, MAX_TIME_IN_FRESH_PACK); + if (this.requestsTimeout.unref) this.requestsTimeout.unref(); + } + } + + stopCapturingRequests() { + if (this.requestsTimeout !== undefined) { + clearTimeout(this.requestsTimeout); + this.requestsTimeout = undefined; } } @@ -1232,6 +1240,7 @@ class PackFileCacheStrategy { const reportProgress = ProgressPlugin.getReporter(this.compiler); return (this.storePromise = packPromise .then(pack => { + pack.stopCapturingRequests(); if (!pack.invalid) return; this.packPromise = undefined; this.logger.log(`Storing pack...`);