Skip to content

Commit

Permalink
Update successUrlsThreshold calculation formula
Browse files Browse the repository at this point in the history
  • Loading branch information
haqadn committed Jun 16, 2023
1 parent 66dd5aa commit 2731e57
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/generate-critical-css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ export async function generateCriticalCSS( {
successRatio?: number;
maxPages?: number;
} ): Promise< [ string, Error[] ] > {
const successUrlsThreshold = Math.ceil( urls.length * successRatio );
// Success threshold is calculated based on the success ratio of "the number of URLs provided", or "maxPages" whichever is lower.
// See 268-gh-Automattic/boost-cloud
const successUrlsThreshold = Math.ceil( Math.min( urls.length, maxPages ) * successRatio );

try {
progressCallback = progressCallback || noop;
Expand Down

0 comments on commit 2731e57

Please sign in to comment.