Просмотр исходного кода

[web] upload to CDN buckets concurrently (#23494)

* [web] upload to CDN buckets concurrently

* [web] documentation for detaching, recording of pid and waiting

GitOrigin-RevId: abdb357771d9c5e34330827b146ae43eb6146675
Jakob Ackermann 1 год назад
Родитель
Сommit
0f57110de0
1 измененных файлов с 9 добавлено и 2 удалено
  1. 9 2
      services/web/bin/cdn_upload

+ 9 - 2
services/web/bin/cdn_upload

@@ -55,10 +55,17 @@ if [[ "$BRANCH_NAME" == "main" ]] || [[ "$BRANCH_NAME" == "staging-main" ]]; the
   bin/compress_assets
 
   upload_into_bucket "$CDN_STAG" &&
-    verify_upload_into_bucket "$CDN_STAG" || exit 3
+    verify_upload_into_bucket "$CDN_STAG" || exit 3 &
+  pid_staging=$! # record pid of the detached process "upload && verify || exit 3")
+
+  pid_production=
   # Only upload to production CDN if branch is
   if [[ "$BRANCH_NAME" == "main" ]]; then
     upload_into_bucket "$CDN_PROD" &&
-      verify_upload_into_bucket "$CDN_PROD" || exit 3
+      verify_upload_into_bucket "$CDN_PROD" || exit 4 &
+    pid_production=$! # record pid of the detached process "upload && verify || exit 4")
   fi
+
+  wait "$pid_staging" # wait for staging upload to finish, wait(1) will exit if the upload failed
+  wait "$pid_production" # wait for production upload to finish (if started), wait(1) will exit if the upload failed
 fi