From 83ce660c0a35a8746c8dbe879a59bda348f5f1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Thu, 6 May 2021 18:43:48 +0200 Subject: [PATCH] chore(v2): delay i18n-staging deployment to avoid Crowdin 409 errors (#4740) --- website/waitForCrowdin.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/website/waitForCrowdin.js b/website/waitForCrowdin.js index 403c109672..a87b2c3174 100644 --- a/website/waitForCrowdin.js +++ b/website/waitForCrowdin.js @@ -33,6 +33,20 @@ async function hasBuildInProgress() { } async function run() { + // We delay a bit the i18n staging deployment + // Because sometimes, prod + i18n-staging call this script at the exact same time + // And then both try to dl the translations at the same time, and then we have a 409 error + // This delay makes sure prod starts to dl the translations in priority + if ( + process.env.NETLIFY === 'true' && + process.env.SITE_NAME === 'docusaurus-i18n-staging' + ) { + console.log( + '[Crowdin] Delaying the docusaurus-i18n-staging deployment to avoid 409 errors', + ); + await delay(30000); + } + const timeBefore = Date.now(); while (true) { if (Date.now() - timeBefore > timeout) {