You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement retry mechanisms for network download functionality (#199)
* write a custom curl retry method
* retry SDK install
* retry windows install
* check windows download for corruption and ensure file length is valid
* account for partially installed sdks
* add retry logic to install-vsb.ps1
* remove file with retry on windows
log "swift sdk install failed with exit code $exit_code on attempt $attempt"
93
+
94
+
# Exponential backoff: double the delay each time
95
+
retry_delay=$((retry_delay *2))
96
+
fi
97
+
98
+
attempt=$((attempt +1))
99
+
done
100
+
101
+
error "${sdk_type} SDK installation failed after $SDK_INSTALL_MAX_RETRIES attempts"
102
+
return 1
103
+
}
104
+
20
105
# Parse command line options
21
106
INSTALL_ANDROID=false
22
107
INSTALL_STATIC_LINUX=false
@@ -125,7 +210,7 @@ find_latest_swift_version() {
125
210
log "Fetching releases from swift.org API..."
126
211
127
212
local releases_json
128
-
releases_json=$(curl -fsSL "${SWIFT_API_INSTALL_ROOT}/releases.json")|| fatal "Failed to fetch Swift releases"
213
+
releases_json=$(curl_with_retry -fsSL "${SWIFT_API_INSTALL_ROOT}/releases.json")|| fatal "Failed to fetch Swift releases"
129
214
130
215
# Find all releases that start with the minor version (e.g, "6.1")
131
216
# Sort them and get the latest one
@@ -212,7 +297,7 @@ find_latest_sdk_snapshot() {
212
297
log "Fetching development snapshots from swift.org API..."
213
298
214
299
local sdk_json
215
-
sdk_json=$(curl -fsSL "${SWIFT_API_INSTALL_ROOT}/dev/${version}/${sdk_name}-sdk.json")|| fatal "Failed to fetch ${sdk_name}-sdk development snapshots"
300
+
sdk_json=$(curl_with_retry -fsSL "${SWIFT_API_INSTALL_ROOT}/dev/${version}/${sdk_name}-sdk.json")|| fatal "Failed to fetch ${sdk_name}-sdk development snapshots"
216
301
217
302
# Extract the snapshot tag from the "dir" field of the first (newest) element
0 commit comments