flowscale 1.0.17-beta.3 → 1.0.17-beta.5
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/index.js +16 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -174,23 +174,27 @@ var FlowscaleAPI = /** @class */ (function () {
|
|
|
174
174
|
attempts = 0;
|
|
175
175
|
_c.label = 2;
|
|
176
176
|
case 2:
|
|
177
|
-
if (!true) return [3 /*break*/,
|
|
177
|
+
if (!true) return [3 /*break*/, 11];
|
|
178
178
|
if (Date.now() - startTime > timeoutMs) {
|
|
179
179
|
throw new Error("Workflow execution timed out after ".concat(timeoutMs, "ms"));
|
|
180
180
|
}
|
|
181
181
|
_c.label = 3;
|
|
182
182
|
case 3:
|
|
183
|
-
_c.trys.push([3,
|
|
183
|
+
_c.trys.push([3, 8, , 9]);
|
|
184
184
|
return [4 /*yield*/, this.getOutput(outputName)];
|
|
185
185
|
case 4:
|
|
186
186
|
output = _c.sent();
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
return [3 /*break*/, 6];
|
|
187
|
+
console.log("DEBUG:", output);
|
|
188
|
+
if (!output) return [3 /*break*/, 7];
|
|
189
|
+
if (!(output.status === 'in_progress')) return [3 /*break*/, 6];
|
|
190
|
+
attempts++;
|
|
191
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, pollIntervalMs); })];
|
|
193
192
|
case 5:
|
|
193
|
+
_c.sent();
|
|
194
|
+
_c.label = 6;
|
|
195
|
+
case 6: return [2 /*return*/, output]; // Return the output when available
|
|
196
|
+
case 7: return [3 /*break*/, 9];
|
|
197
|
+
case 8:
|
|
194
198
|
error_1 = _c.sent();
|
|
195
199
|
// Log the error but continue polling
|
|
196
200
|
console.warn("Error polling for output (attempt ".concat(attempts, "):"), error_1);
|
|
@@ -198,16 +202,16 @@ var FlowscaleAPI = /** @class */ (function () {
|
|
|
198
202
|
if (attempts > 5) {
|
|
199
203
|
pollIntervalMs = Math.min(pollIntervalMs * 1.5, 10000); // Increase interval, max 10s
|
|
200
204
|
}
|
|
201
|
-
return [3 /*break*/,
|
|
202
|
-
case
|
|
205
|
+
return [3 /*break*/, 9];
|
|
206
|
+
case 9:
|
|
203
207
|
attempts++;
|
|
204
208
|
// Wait for the polling interval
|
|
205
209
|
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, pollIntervalMs); })];
|
|
206
|
-
case
|
|
210
|
+
case 10:
|
|
207
211
|
// Wait for the polling interval
|
|
208
212
|
_c.sent();
|
|
209
213
|
return [3 /*break*/, 2];
|
|
210
|
-
case
|
|
214
|
+
case 11: return [2 /*return*/];
|
|
211
215
|
}
|
|
212
216
|
});
|
|
213
217
|
});
|