Skip to content

Commit 2731e57

Browse files
committed
Update successUrlsThreshold calculation formula
1 parent 66dd5aa commit 2731e57

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/generate-critical-css.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ export async function generateCriticalCSS( {
153153
successRatio?: number;
154154
maxPages?: number;
155155
} ): Promise< [ string, Error[] ] > {
156-
const successUrlsThreshold = Math.ceil( urls.length * successRatio );
156+
// Success threshold is calculated based on the success ratio of "the number of URLs provided", or "maxPages" whichever is lower.
157+
// See 268-gh-Automattic/boost-cloud
158+
const successUrlsThreshold = Math.ceil( Math.min( urls.length, maxPages ) * successRatio );
157159

158160
try {
159161
progressCallback = progressCallback || noop;

0 commit comments

Comments
 (0)