Skip to content

Commit 0608fa3

Browse files
authored
chore(site): fix supporters' download (#4859)
1 parent 785aeb1 commit 0608fa3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/_data/supporters.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const SPONSOR_TIER = 'sponsors';
5252
const BACKER_TIER = 'backers';
5353

5454
// if this percent of fetches completes, the build will pass
55-
const PRODUCTION_SUCCESS_THRESHOLD = 0.8;
55+
const PRODUCTION_SUCCESS_THRESHOLD = 0.9;
5656

5757
const SUPPORTER_IMAGE_PATH = resolve(__dirname, '../images/supporters');
5858

@@ -107,7 +107,7 @@ const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD
107107
try {
108108
const {avatar: url} = supporter;
109109
const {body: imageBuf, headers} = await needle('get', url, {
110-
timeout: 2000
110+
open_timeout: 30000
111111
});
112112
if (headers['content-type'].startsWith('text/html')) {
113113
throw new TypeError(
@@ -247,16 +247,16 @@ const getSupporters = async () => {
247247

248248
const backerCount = supporters[BACKER_TIER].length;
249249
const sponsorCount = supporters[SPONSOR_TIER].length;
250-
const totalValidSupportersCount = backerCount + sponsorCount;
251-
const successRate = totalValidSupportersCount / invalidSupporters.length;
250+
const totalSupportersCount = backerCount + sponsorCount;
251+
const successRate = 1 - invalidSupporters.length / totalSupportersCount;
252252

253253
debug(
254254
'found %d valid backers and %d valid sponsors (%d total; %d invalid; %d blocked)',
255255
backerCount,
256256
sponsorCount,
257-
totalValidSupportersCount,
257+
totalSupportersCount,
258258
invalidSupporters.length,
259-
uniqueSupporters.size - totalValidSupportersCount
259+
uniqueSupporters.size - totalSupportersCount
260260
);
261261

262262
if (successRate < PRODUCTION_SUCCESS_THRESHOLD) {

0 commit comments

Comments
 (0)