From 3c2b8e0096f9a7e506a8fe8b34909a60c541341f Mon Sep 17 00:00:00 2001 From: Aditya Thakral Date: Fri, 3 Sep 2021 16:05:40 -0400 Subject: [PATCH] Add retries if resource doesn't exist --- scripts/mdx-scripts/talk-conversion.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/mdx-scripts/talk-conversion.js b/scripts/mdx-scripts/talk-conversion.js index 6d7ba55..e8f0230 100644 --- a/scripts/mdx-scripts/talk-conversion.js +++ b/scripts/mdx-scripts/talk-conversion.js @@ -125,14 +125,16 @@ ${converter.makeMarkdown(abstract ?? "")} * @param {string} url */ async function resourceExists(url) { - const time = Math.trunc(Math.random() * 10000); await sleep(time); - const timer = setTimeout(() => console.log("not done", time, url), time + 3000); + const timer = setTimeout(() => { + console.log("retrying", time, url); + resourceExists(url); + }, time + 3000); const response = await fetch(url); - clearTimeout(timer) + clearTimeout(timer); return ( response.status.toString().startsWith("2") ||