@devicecloud.dev/dcd 3.7.8 → 3.7.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/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +33 -4
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/dist/commands/status.js
CHANGED
|
@@ -52,11 +52,40 @@ class Status extends core_1.Command {
|
|
|
52
52
|
this.error('Either --name or --upload-id must be provided');
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
+
let lastError = null;
|
|
56
|
+
let status = null;
|
|
57
|
+
for (let attempt = 1; attempt <= 5; attempt++) {
|
|
58
|
+
try {
|
|
59
|
+
status = (await ApiGateway_1.ApiGateway.getUploadStatus(apiUrl, apiKey, {
|
|
60
|
+
name,
|
|
61
|
+
uploadId,
|
|
62
|
+
}));
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
lastError = error;
|
|
67
|
+
if (attempt < 5) {
|
|
68
|
+
this.log(`Network error on attempt ${attempt}/5. Retrying...`);
|
|
69
|
+
await new Promise((resolve) => setTimeout(resolve, 1000 * attempt));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!status) {
|
|
74
|
+
const errorMessage = `Failed to get status after 5 attempts. Check your network. Last error: ${lastError?.message || 'Unknown error'}`;
|
|
75
|
+
if (json) {
|
|
76
|
+
return {
|
|
77
|
+
status: 'FAILED',
|
|
78
|
+
tests: [],
|
|
79
|
+
error: errorMessage,
|
|
80
|
+
attempts: 5,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this.error(errorMessage);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
55
88
|
try {
|
|
56
|
-
const status = (await ApiGateway_1.ApiGateway.getUploadStatus(apiUrl, apiKey, {
|
|
57
|
-
name,
|
|
58
|
-
uploadId,
|
|
59
|
-
}));
|
|
60
89
|
if (json) {
|
|
61
90
|
return status;
|
|
62
91
|
}
|
package/oclif.manifest.json
CHANGED