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...`);