@xiboplayer/utils 0.6.7 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/fetch-retry.js +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiboplayer/utils",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "Shared utilities for Xibo Player packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"./config": "./src/config.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@xiboplayer/crypto": "0.6.
|
|
15
|
+
"@xiboplayer/crypto": "0.6.9"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"vitest": "^2.0.0"
|
package/src/fetch-retry.js
CHANGED
|
@@ -74,8 +74,10 @@ export async function fetchWithRetry(url, options = {}, retryOptions = {}) {
|
|
|
74
74
|
break; // Exhausted retries
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// Don't retry
|
|
78
|
-
|
|
77
|
+
// Don't retry anything below 500 — only 5xx server errors are retryable.
|
|
78
|
+
// This covers 2xx (success), 3xx (redirects including 304 Not Modified),
|
|
79
|
+
// and 4xx (client errors that won't change with retries).
|
|
80
|
+
if (response.status < 500) {
|
|
79
81
|
return response;
|
|
80
82
|
}
|
|
81
83
|
|
|
@@ -96,6 +98,7 @@ export async function fetchWithRetry(url, options = {}, retryOptions = {}) {
|
|
|
96
98
|
}
|
|
97
99
|
} catch (error) {
|
|
98
100
|
// Network error — retryable
|
|
101
|
+
log.warn(`Fetch error (attempt ${attempt + 1}/${maxRetries + 1}):`, error.message || error, String(url).slice(0, 80));
|
|
99
102
|
lastError = error;
|
|
100
103
|
lastResponse = null;
|
|
101
104
|
}
|