Kaynağa Gözat

Merge pull request #11270 from overleaf/jpa-retry-translations-upload

[web] scripts: add retry to translations upload script

GitOrigin-RevId: b67af0def876d5e1dd0478e7b8fcd234bfc05447
Jakob Ackermann 3 yıl önce
ebeveyn
işleme
dea52fec6f
1 değiştirilmiş dosya ile 14 ekleme ve 1 silme
  1. 14 1
      services/web/scripts/translations/upload.js

+ 14 - 1
services/web/scripts/translations/upload.js

@@ -40,11 +40,24 @@ async function pollUploadStatus(importId) {
   }
 }
 
-async function main() {
+async function uploadOnce() {
   const importId = await uploadLocales()
   await pollUploadStatus(importId)
 }
 
+async function main() {
+  try {
+    await uploadOnce()
+  } catch (err) {
+    console.error('--- upload failed once ---')
+    console.error(err)
+    console.error('--- upload failed once ---')
+    console.log('retrying upload in 30s')
+    await sleep(30_000)
+    await uploadOnce()
+  }
+}
+
 main().catch(error => {
   console.error({ error })
   process.exit(1)