ardent-cli 0.0.48 → 0.0.49

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -384,6 +384,15 @@ function isGatewayTimeoutError(err) {
384
384
  }
385
385
  return isNetworkError(err);
386
386
  }
387
+ function isTransientOperationPollError(err) {
388
+ if (isGatewayTimeoutError(err)) {
389
+ return true;
390
+ }
391
+ if (!(err instanceof Error)) {
392
+ return false;
393
+ }
394
+ return err.message.trim().toLowerCase() === "api error 500: internal server error";
395
+ }
387
396
 
388
397
  // src/lib/connector_selection.ts
389
398
  function clearSelectedConnector() {
@@ -1306,6 +1315,9 @@ function assertEngineSetupCompleted(operation, connectorName) {
1306
1315
  }
1307
1316
 
1308
1317
  // src/lib/engine_setup.ts
1318
+ var ENGINE_SETUP_MAX_WAIT_MS = 60 * 60 * 1e3;
1319
+ var ENGINE_SETUP_POLL_INTERVAL_MS = 5 * 1e3;
1320
+ var ENGINE_SETUP_TRANSIENT_WARN_EVERY = 6;
1309
1321
  var EngineSetupTimeoutError = class extends Error {
1310
1322
  constructor(message) {
1311
1323
  super(message);
@@ -1322,7 +1334,7 @@ var EngineSetupOperationFailedError = class extends Error {
1322
1334
  this.operationError = operationError;
1323
1335
  }
1324
1336
  };
1325
- async function runEngineSetupWithPolling(connectorId, connectorName) {
1337
+ async function runEngineSetupWithPolling(connectorId, connectorName, options = {}) {
1326
1338
  let dispatch;
1327
1339
  try {
1328
1340
  dispatch = await api.post(
@@ -1342,18 +1354,28 @@ async function runEngineSetupWithPolling(connectorId, connectorName) {
1342
1354
  return { dispatched: false };
1343
1355
  }
1344
1356
  const startedAt = Date.now();
1345
- const maxWaitMs = 20 * 60 * 1e3;
1346
- const pollIntervalMs = 5 * 1e3;
1357
+ const maxWaitMs = options.maxWaitMs ?? ENGINE_SETUP_MAX_WAIT_MS;
1358
+ const pollIntervalMs = options.pollIntervalMs ?? ENGINE_SETUP_POLL_INTERVAL_MS;
1347
1359
  let lastStage = null;
1360
+ let consecutiveTransientFailures = 0;
1348
1361
  while (Date.now() - startedAt < maxWaitMs) {
1349
1362
  await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
1350
1363
  let op;
1351
1364
  try {
1352
1365
  op = await api.get(`/v1/operations/${operationId}`);
1353
1366
  } catch (pollErr) {
1354
- if (isGatewayTimeoutError(pollErr)) continue;
1367
+ if (isTransientOperationPollError(pollErr)) {
1368
+ consecutiveTransientFailures += 1;
1369
+ if (consecutiveTransientFailures % ENGINE_SETUP_TRANSIENT_WARN_EVERY === 0) {
1370
+ console.warn(
1371
+ ` \u26A0 Status check has failed ${consecutiveTransientFailures} times in a row. Setup is still running server-side and the CLI will keep waiting \u2014 do NOT delete the connector.`
1372
+ );
1373
+ }
1374
+ continue;
1375
+ }
1355
1376
  throw pollErr;
1356
1377
  }
1378
+ consecutiveTransientFailures = 0;
1357
1379
  if (op.stage && op.stage !== lastStage) {
1358
1380
  const progressLabel = op.progress != null ? ` (${op.progress}%)` : "";
1359
1381
  console.log(` ${operationStageDisplay(op.stage)}${progressLabel}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ardent-cli",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "Git for Data infrastructure",
5
5
  "type": "module",
6
6
  "bin": {