From 4331984c297d88e28465333b22b866f77099abee Mon Sep 17 00:00:00 2001 From: Francois Daoust Date: Wed, 2 Oct 2024 17:02:57 +0200 Subject: [PATCH] Increase sleep time to retrieve chairs emails The CDN in front of W3C servers seems to have become more picky over rate limits and rejects requests that are chained too fast. Making the code sleep 4s in between requests seems to solve the issue (but makes the script take a long long time :(). --- tools/list-chairs.mjs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/list-chairs.mjs b/tools/list-chairs.mjs index e7e6dd6..c59c218 100644 --- a/tools/list-chairs.mjs +++ b/tools/list-chairs.mjs @@ -78,15 +78,20 @@ async function main(format) { await authenticate(page, W3C_LOGIN, W3C_PASSWORD, url); chair.email = await page.evaluate(() => { const el = document.querySelector('.card--user a[href^=mailto]'); - return el.textContent.trim(); + if (el) { + return el.textContent.trim(); + } + else { + return 'no email address found in user page'; + } }); + console.warn('Wait 4s to ease load on server...'); + await sleep(4000); + console.warn('Wait 4s to ease load on server... done'); } finally { page.close(); } - console.warn('Wait 1s to ease load on server...'); - await sleep(1000); - console.warn('Wait 1s to ease load on server... done'); } } finally {