@empiricalrun/r2-uploader 0.1.0 → 0.1.1
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,UAAU,OAAO;IACf,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,UAAU,OAAO;IACf,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAuID,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACX,eAAe,GAChB,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,OAAO,CAAC,CAYnB"}
|
package/dist/index.js
CHANGED
|
@@ -111,11 +111,12 @@ const run = async (config) => {
|
|
|
111
111
|
catch (err) {
|
|
112
112
|
const error = err;
|
|
113
113
|
if (error["$metadata"]) {
|
|
114
|
+
// throw only those errors that are not 412 Precondition Failed
|
|
115
|
+
// 412 errors are errors while accessing the asset, which is post upload and can be ignored
|
|
114
116
|
if (error.$metadata.httpStatusCode !== 412) {
|
|
115
117
|
throw error;
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
|
-
console.log("Error which is not retried", error);
|
|
119
120
|
}
|
|
120
121
|
}, {
|
|
121
122
|
retries: 5,
|
|
@@ -123,6 +124,13 @@ const run = async (config) => {
|
|
|
123
124
|
minTimeout: 1000,
|
|
124
125
|
maxTimeout: 60000,
|
|
125
126
|
randomize: true,
|
|
127
|
+
onRetry: (err, i) => {
|
|
128
|
+
if (err) {
|
|
129
|
+
const error = err;
|
|
130
|
+
console.log("Upload retry attempt:", i, ":", file);
|
|
131
|
+
console.log("Response status:", error.$response?.statusCode);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
126
134
|
});
|
|
127
135
|
}
|
|
128
136
|
catch (err) {
|