@somewhere-cloud/cli 0.38.175 → 0.38.177
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 +8 -0
- package/dist/lib/bundle.js +134 -70
- package/dist/lib/bundle.js.map +2 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.38.177
|
|
4
|
+
|
|
5
|
+
- Retry interrupted static uploads before completing a deploy.
|
|
6
|
+
|
|
7
|
+
## 0.38.176
|
|
8
|
+
|
|
9
|
+
- Upload large static sites faster and show hashing and upload times with `deploy --timing`.
|
|
10
|
+
|
|
3
11
|
## 0.38.175
|
|
4
12
|
|
|
5
13
|
- Enabled apps can deploy larger static sites and upload only files that changed.
|
package/dist/lib/bundle.js
CHANGED
|
@@ -1299,9 +1299,9 @@ var require_timers = __commonJS({
|
|
|
1299
1299
|
* before the specified function or code is executed.
|
|
1300
1300
|
* @param {*} arg
|
|
1301
1301
|
*/
|
|
1302
|
-
constructor(callback,
|
|
1302
|
+
constructor(callback, delay3, arg) {
|
|
1303
1303
|
this._onTimeout = callback;
|
|
1304
|
-
this._idleTimeout =
|
|
1304
|
+
this._idleTimeout = delay3;
|
|
1305
1305
|
this._timerArg = arg;
|
|
1306
1306
|
this.refresh();
|
|
1307
1307
|
}
|
|
@@ -1346,8 +1346,8 @@ var require_timers = __commonJS({
|
|
|
1346
1346
|
* when the timer expires.
|
|
1347
1347
|
* @returns {NodeJS.Timeout|FastTimer}
|
|
1348
1348
|
*/
|
|
1349
|
-
setTimeout(callback,
|
|
1350
|
-
return
|
|
1349
|
+
setTimeout(callback, delay3, arg) {
|
|
1350
|
+
return delay3 <= RESOLUTION_MS ? setTimeout(callback, delay3, arg) : new FastTimer(callback, delay3, arg);
|
|
1351
1351
|
},
|
|
1352
1352
|
/**
|
|
1353
1353
|
* The clearTimeout method cancels an instantiated Timer previously created
|
|
@@ -1373,8 +1373,8 @@ var require_timers = __commonJS({
|
|
|
1373
1373
|
* when the timer expires.
|
|
1374
1374
|
* @returns {FastTimer}
|
|
1375
1375
|
*/
|
|
1376
|
-
setFastTimeout(callback,
|
|
1377
|
-
return new FastTimer(callback,
|
|
1376
|
+
setFastTimeout(callback, delay3, arg) {
|
|
1377
|
+
return new FastTimer(callback, delay3, arg);
|
|
1378
1378
|
},
|
|
1379
1379
|
/**
|
|
1380
1380
|
* The clearTimeout method cancels an instantiated FastTimer previously
|
|
@@ -1400,8 +1400,8 @@ var require_timers = __commonJS({
|
|
|
1400
1400
|
* @deprecated
|
|
1401
1401
|
* @param {number} [delay=0] The delay in milliseconds to add to the now value.
|
|
1402
1402
|
*/
|
|
1403
|
-
tick(
|
|
1404
|
-
fastNow +=
|
|
1403
|
+
tick(delay3 = 0) {
|
|
1404
|
+
fastNow += delay3 - RESOLUTION_MS + 1;
|
|
1405
1405
|
onTick();
|
|
1406
1406
|
onTick();
|
|
1407
1407
|
},
|
|
@@ -9416,29 +9416,29 @@ var require_parser_h1 = __commonJS({
|
|
|
9416
9416
|
this.updateBuffers();
|
|
9417
9417
|
}
|
|
9418
9418
|
}
|
|
9419
|
-
setTimeout(
|
|
9420
|
-
if (
|
|
9419
|
+
setTimeout(delay3, type) {
|
|
9420
|
+
if (delay3 !== this.timeoutValue || type & USE_FAST_TIMER ^ this.timeoutType & USE_FAST_TIMER) {
|
|
9421
9421
|
if (this.timeout) {
|
|
9422
9422
|
timers.clearTimeout(this.timeout);
|
|
9423
9423
|
this.timeout = null;
|
|
9424
9424
|
}
|
|
9425
|
-
if (
|
|
9425
|
+
if (delay3) {
|
|
9426
9426
|
if (type & USE_FAST_TIMER) {
|
|
9427
9427
|
this.timeout = timers.setFastTimeout(
|
|
9428
9428
|
onParserTimeout,
|
|
9429
|
-
|
|
9429
|
+
delay3,
|
|
9430
9430
|
this.timeoutWeakRef
|
|
9431
9431
|
);
|
|
9432
9432
|
} else {
|
|
9433
9433
|
this.timeout = setTimeout(
|
|
9434
9434
|
onParserTimeout,
|
|
9435
|
-
|
|
9435
|
+
delay3,
|
|
9436
9436
|
this.timeoutWeakRef
|
|
9437
9437
|
);
|
|
9438
9438
|
this.timeout?.unref();
|
|
9439
9439
|
}
|
|
9440
9440
|
}
|
|
9441
|
-
this.timeoutValue =
|
|
9441
|
+
this.timeoutValue = delay3;
|
|
9442
9442
|
} else if (this.timeout?.refresh) {
|
|
9443
9443
|
this.timeout.refresh();
|
|
9444
9444
|
}
|
|
@@ -11024,21 +11024,21 @@ var require_client_h1 = __commonJS({
|
|
|
11024
11024
|
this.connection = "";
|
|
11025
11025
|
this.maxResponseSize = client[kMaxResponseSize];
|
|
11026
11026
|
}
|
|
11027
|
-
setTimeout(
|
|
11028
|
-
if (
|
|
11027
|
+
setTimeout(delay3, type) {
|
|
11028
|
+
if (delay3 !== this.timeoutValue || type & USE_FAST_TIMER ^ this.timeoutType & USE_FAST_TIMER) {
|
|
11029
11029
|
if (this.timeout) {
|
|
11030
11030
|
timers.clearTimeout(this.timeout);
|
|
11031
11031
|
this.timeout = null;
|
|
11032
11032
|
}
|
|
11033
|
-
if (
|
|
11033
|
+
if (delay3) {
|
|
11034
11034
|
if (type & USE_FAST_TIMER) {
|
|
11035
|
-
this.timeout = timers.setFastTimeout(onParserTimeout,
|
|
11035
|
+
this.timeout = timers.setFastTimeout(onParserTimeout, delay3, this.timeoutWeakRef);
|
|
11036
11036
|
} else {
|
|
11037
|
-
this.timeout = setTimeout(onParserTimeout,
|
|
11037
|
+
this.timeout = setTimeout(onParserTimeout, delay3, this.timeoutWeakRef);
|
|
11038
11038
|
this.timeout?.unref();
|
|
11039
11039
|
}
|
|
11040
11040
|
}
|
|
11041
|
-
this.timeoutValue =
|
|
11041
|
+
this.timeoutValue = delay3;
|
|
11042
11042
|
} else if (this.timeout) {
|
|
11043
11043
|
if (this.timeout.refresh) {
|
|
11044
11044
|
this.timeout.refresh();
|
|
@@ -19157,7 +19157,7 @@ var require_mock_utils = __commonJS({
|
|
|
19157
19157
|
}
|
|
19158
19158
|
__name(mockDispatch, "mockDispatch");
|
|
19159
19159
|
function dispatchMockReply(mockDispatches, mockDispatch2, key, opts, handler, resolvedResponse) {
|
|
19160
|
-
const { data: responseData, delay:
|
|
19160
|
+
const { data: responseData, delay: delay3 } = mockDispatch2;
|
|
19161
19161
|
const response = resolvedResponse ?? responseData;
|
|
19162
19162
|
if (response.error !== null) {
|
|
19163
19163
|
deleteMockDispatch(mockDispatches, key);
|
|
@@ -19249,11 +19249,11 @@ var require_mock_utils = __commonJS({
|
|
|
19249
19249
|
handleReply(dispatches, { ...responseDefaults, ...callbackResult });
|
|
19250
19250
|
return;
|
|
19251
19251
|
}
|
|
19252
|
-
if (typeof
|
|
19252
|
+
if (typeof delay3 === "number" && delay3 > 0) {
|
|
19253
19253
|
timer = setTimeout(() => {
|
|
19254
19254
|
timer = null;
|
|
19255
19255
|
handleReply(dispatches);
|
|
19256
|
-
},
|
|
19256
|
+
}, delay3);
|
|
19257
19257
|
} else {
|
|
19258
19258
|
handleReply(dispatches);
|
|
19259
19259
|
}
|
|
@@ -63537,13 +63537,13 @@ var init_streamableHttp = __esm({
|
|
|
63537
63537
|
this.onerror?.(new Error(`Maximum reconnection attempts (${maxRetries}) exceeded.`));
|
|
63538
63538
|
return;
|
|
63539
63539
|
}
|
|
63540
|
-
const
|
|
63540
|
+
const delay3 = this._getNextReconnectionDelay(attemptCount);
|
|
63541
63541
|
this._reconnectionTimeout = setTimeout(() => {
|
|
63542
63542
|
this._startOrAuthSse(options2).catch((error3) => {
|
|
63543
63543
|
this.onerror?.(new Error(`Failed to reconnect SSE stream: ${error3 instanceof Error ? error3.message : String(error3)}`));
|
|
63544
63544
|
this._scheduleReconnection(options2, attemptCount + 1);
|
|
63545
63545
|
});
|
|
63546
|
-
},
|
|
63546
|
+
}, delay3);
|
|
63547
63547
|
}
|
|
63548
63548
|
_handleSseStream(stream, options2, isReconnectable) {
|
|
63549
63549
|
if (!stream) {
|
|
@@ -78418,11 +78418,11 @@ async function awaitDeployChecks(client, checks, opts = {}) {
|
|
|
78418
78418
|
const sleep5 = opts.sleep ?? ((ms2) => new Promise((r) => setTimeout(r, ms2)));
|
|
78419
78419
|
const deadline = now2() + (opts.waitMs ?? TEST_CHECKS_WAIT_MS);
|
|
78420
78420
|
let last = null;
|
|
78421
|
-
let
|
|
78421
|
+
let delay3 = opts.firstDelayMs ?? 0;
|
|
78422
78422
|
let rateLimited = false;
|
|
78423
|
-
for (let attempt = 0; now2() +
|
|
78424
|
-
if (
|
|
78425
|
-
await sleep5(
|
|
78423
|
+
for (let attempt = 0; now2() + delay3 <= deadline; attempt++) {
|
|
78424
|
+
if (delay3)
|
|
78425
|
+
await sleep5(delay3);
|
|
78426
78426
|
let retryAfter = 0;
|
|
78427
78427
|
try {
|
|
78428
78428
|
const read = await client.call("GET", target.path, void 0, target.query, { timeoutMs: Math.max(1e3, deadline - now2()), onRetryAfter: /* @__PURE__ */ __name((ms2) => {
|
|
@@ -78441,7 +78441,7 @@ async function awaitDeployChecks(client, checks, opts = {}) {
|
|
|
78441
78441
|
return null;
|
|
78442
78442
|
rateLimited ||= retryAfter > 0;
|
|
78443
78443
|
}
|
|
78444
|
-
|
|
78444
|
+
delay3 = Math.max(opts.pollMs ?? interactivePollDelay(attempt), retryAfter);
|
|
78445
78445
|
}
|
|
78446
78446
|
return last ?? (rateLimited && opts.readStored ? { status: "unavailable", sentence: "The platform asked us to wait before reading the check again." } : null);
|
|
78447
78447
|
}
|
|
@@ -78905,6 +78905,7 @@ var init_build_errors = __esm({
|
|
|
78905
78905
|
// dist/lib/deploy-blobs.js
|
|
78906
78906
|
import { createReadStream } from "node:fs";
|
|
78907
78907
|
import { join as join23 } from "node:path";
|
|
78908
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
78908
78909
|
async function uploadDeployBlobs(client, dir, projectId, paths, hashes) {
|
|
78909
78910
|
const files = /* @__PURE__ */ new Map();
|
|
78910
78911
|
for (const [path3, size] of paths) {
|
|
@@ -78913,45 +78914,102 @@ async function uploadDeployBlobs(client, dir, projectId, paths, hashes) {
|
|
|
78913
78914
|
}
|
|
78914
78915
|
process.stderr.write(`Checking ${paths.size} static files...
|
|
78915
78916
|
`);
|
|
78916
|
-
const
|
|
78917
|
+
const checkStarted = performance.now();
|
|
78918
|
+
const { missing, upload_grant: grant } = await client.call("POST", "/deploy/blobs/check", {
|
|
78917
78919
|
project_id: projectId,
|
|
78920
|
+
upload_grants: true,
|
|
78918
78921
|
files: [...files.values()].map(({ sha256: sha2563, size }) => ({ sha256: sha2563, size }))
|
|
78919
78922
|
}, void 0, { timeoutMs: LONG_CALL_TIMEOUT_MS });
|
|
78923
|
+
const checkMs = performance.now() - checkStarted;
|
|
78920
78924
|
process.stderr.write(`Uploading ${missing.length} of ${files.size} distinct static files.
|
|
78921
78925
|
`);
|
|
78926
|
+
const uploadStarted = performance.now();
|
|
78927
|
+
const queue = missing.map((sha2563) => {
|
|
78928
|
+
const file = files.get(sha2563);
|
|
78929
|
+
if (!file || grant && !grant.proofs[sha2563]) {
|
|
78930
|
+
throw new Error("The upload check returned an unexpected file or grant. Nothing was published.");
|
|
78931
|
+
}
|
|
78932
|
+
return file;
|
|
78933
|
+
});
|
|
78934
|
+
const query = new URLSearchParams({ project_id: grant?.project_id ?? projectId });
|
|
78935
|
+
const failures = [];
|
|
78922
78936
|
let next = 0;
|
|
78923
|
-
let
|
|
78924
|
-
|
|
78925
|
-
|
|
78926
|
-
|
|
78927
|
-
|
|
78928
|
-
|
|
78929
|
-
|
|
78930
|
-
|
|
78931
|
-
|
|
78932
|
-
|
|
78933
|
-
|
|
78934
|
-
|
|
78937
|
+
let concurrency = grant ? GRANTED_PARALLEL_UPLOADS : LEGACY_PARALLEL_UPLOADS;
|
|
78938
|
+
let active = 0;
|
|
78939
|
+
let transientFailures = 0;
|
|
78940
|
+
let waiters = [];
|
|
78941
|
+
async function send(file) {
|
|
78942
|
+
while (active >= concurrency)
|
|
78943
|
+
await new Promise((resolve27) => waiters.push(resolve27));
|
|
78944
|
+
active++;
|
|
78945
|
+
try {
|
|
78946
|
+
const response = await client.callStream("PUT", `/deploy/blobs/${file.sha256}?${query}`, () => createReadStream(join23(dir, file.path)), {
|
|
78947
|
+
headers: {
|
|
78948
|
+
"Content-Type": "application/octet-stream",
|
|
78949
|
+
"Content-Length": String(file.size),
|
|
78950
|
+
...grant ? { "x-sw-deploy-upload-grant": grant.proofs[file.sha256] } : {}
|
|
78951
|
+
},
|
|
78952
|
+
replayableBody: true,
|
|
78953
|
+
timeoutMs: LONG_CALL_TIMEOUT_MS
|
|
78954
|
+
});
|
|
78955
|
+
const answer = await response.json().catch(() => null);
|
|
78956
|
+
if (!response.ok || answer?.ok !== true) {
|
|
78957
|
+
throw new CliApiError(answer?.error ?? (response.ok ? "NETWORK_ERROR" : "BLOB_UPLOAD_FAILED"), answer?.message ?? `Upload returned HTTP ${response.status}.`, response.status, void 0, void 0, {
|
|
78958
|
+
retryAfterMs: Math.max(retryAfterMs(response.headers.get("retry-after")) ?? 0, answer?.retry_after_ms ?? 0)
|
|
78935
78959
|
});
|
|
78936
|
-
|
|
78937
|
-
|
|
78938
|
-
|
|
78960
|
+
}
|
|
78961
|
+
} finally {
|
|
78962
|
+
active--;
|
|
78963
|
+
const waiting = waiters;
|
|
78964
|
+
waiters = [];
|
|
78965
|
+
for (const wake of waiting)
|
|
78966
|
+
wake();
|
|
78967
|
+
}
|
|
78968
|
+
}
|
|
78969
|
+
__name(send, "send");
|
|
78970
|
+
await Promise.all(Array.from({ length: Math.min(queue.length, concurrency) }, async () => {
|
|
78971
|
+
while (next < queue.length && !failures.length) {
|
|
78972
|
+
const file = queue[next++];
|
|
78973
|
+
for (let attempt = 1; attempt <= UPLOAD_ATTEMPTS; attempt++) {
|
|
78974
|
+
try {
|
|
78975
|
+
await send(file);
|
|
78976
|
+
break;
|
|
78977
|
+
} catch (cause) {
|
|
78978
|
+
const error3 = cause instanceof CliApiError ? cause : new CliApiError("BLOB_UPLOAD_FAILED", String(cause), 0);
|
|
78979
|
+
const retryable = [429, 503].includes(error3.statusCode) || ["NETWORK_ERROR", "TIMEOUT", "SERVER_SLOW"].includes(error3.code);
|
|
78980
|
+
if (retryable && ++transientFailures >= 2 && concurrency > 4) {
|
|
78981
|
+
concurrency = Math.max(4, Math.floor(concurrency / 2));
|
|
78982
|
+
transientFailures = 0;
|
|
78983
|
+
}
|
|
78984
|
+
if (!retryable || attempt === UPLOAD_ATTEMPTS) {
|
|
78985
|
+
failures.push({ path: file.path, error: error3 });
|
|
78986
|
+
break;
|
|
78987
|
+
}
|
|
78988
|
+
await delay(Math.min(5e3, Math.max(200 * 2 ** (attempt - 1) + Math.random() * 100, error3.meta.retryAfterMs ?? 0)));
|
|
78939
78989
|
}
|
|
78940
|
-
} catch (cause) {
|
|
78941
|
-
failure2 ??= new CliApiError(cause instanceof CliApiError ? cause.code : "BLOB_UPLOAD_FAILED", `Could not upload "${file.path}". ${cause instanceof Error ? cause.message : String(cause)}`, cause instanceof CliApiError ? cause.statusCode : 0);
|
|
78942
78990
|
}
|
|
78943
78991
|
}
|
|
78944
78992
|
}));
|
|
78945
|
-
if (
|
|
78946
|
-
|
|
78947
|
-
|
|
78948
|
-
}
|
|
78949
|
-
|
|
78993
|
+
if (failures.length) {
|
|
78994
|
+
const { error: error3 } = failures[0];
|
|
78995
|
+
const detail = failures.map((failure2) => `"${failure2.path}": ${failure2.error.message}`).join("\n");
|
|
78996
|
+
const remaining = next < queue.length ? ` ${queue.length - next} more files were held back.` : "";
|
|
78997
|
+
throw new CliApiError(error3.code, `Could not upload static files. Nothing was published.${remaining}
|
|
78998
|
+
${detail}`, error3.statusCode);
|
|
78999
|
+
}
|
|
79000
|
+
const uploadMs = performance.now() - uploadStarted;
|
|
79001
|
+
const blobFiles = Object.fromEntries([...paths.keys()].map((path3) => [path3, `sha256:${hashes[path3]}`]));
|
|
79002
|
+
return { blobFiles, checkMs, uploadMs };
|
|
79003
|
+
}
|
|
79004
|
+
var GRANTED_PARALLEL_UPLOADS, LEGACY_PARALLEL_UPLOADS, UPLOAD_ATTEMPTS;
|
|
78950
79005
|
var init_deploy_blobs = __esm({
|
|
78951
79006
|
"dist/lib/deploy-blobs.js"() {
|
|
78952
79007
|
"use strict";
|
|
79008
|
+
init_poll_delay();
|
|
78953
79009
|
init_client();
|
|
78954
|
-
|
|
79010
|
+
GRANTED_PARALLEL_UPLOADS = 24;
|
|
79011
|
+
LEGACY_PARALLEL_UPLOADS = 8;
|
|
79012
|
+
UPLOAD_ATTEMPTS = 3;
|
|
78955
79013
|
__name(uploadDeployBlobs, "uploadDeployBlobs");
|
|
78956
79014
|
}
|
|
78957
79015
|
});
|
|
@@ -84730,6 +84788,7 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
|
|
|
84730
84788
|
include: opts.include ?? [],
|
|
84731
84789
|
deployBlobs: process.env.SOMEWHERE_DEPLOY_BLOBS === "1" && !opts.dryRun && opts.scope !== "functions"
|
|
84732
84790
|
});
|
|
84791
|
+
const hashStartedAt = collected.blobs?.size && opts.timing ? performance.now() : void 0;
|
|
84733
84792
|
const publishedHashes = hashFiles(targetDir, collected.published);
|
|
84734
84793
|
const collectionEndedAt = performance.now();
|
|
84735
84794
|
const collectionMs = collectionEndedAt - collectionStartedAt;
|
|
@@ -85225,7 +85284,12 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
|
|
|
85225
85284
|
}
|
|
85226
85285
|
if (collected.blobs?.size) {
|
|
85227
85286
|
spinner?.stop();
|
|
85228
|
-
|
|
85287
|
+
const { blobFiles, checkMs, uploadMs } = await uploadDeployBlobs(client, targetDir, projectId, collected.blobs, publishedHashes);
|
|
85288
|
+
body.blob_files = blobFiles;
|
|
85289
|
+
if (hashStartedAt !== void 0) {
|
|
85290
|
+
process.stderr.write(`Static file timings (ms) \u2014 hash ${Math.round(collectionEndedAt - hashStartedAt)}, check ${Math.round(checkMs)}, upload ${Math.round(uploadMs)}
|
|
85291
|
+
`);
|
|
85292
|
+
}
|
|
85229
85293
|
if (process.stderr.isTTY)
|
|
85230
85294
|
spinner?.start();
|
|
85231
85295
|
}
|
|
@@ -85794,9 +85858,9 @@ function outcomeUnknown(err) {
|
|
|
85794
85858
|
}
|
|
85795
85859
|
async function recoverDeployOutcome(client, projectId, attemptId) {
|
|
85796
85860
|
const query = { project_id: projectId, deploy_attempt_id: attemptId };
|
|
85797
|
-
for (const
|
|
85798
|
-
if (
|
|
85799
|
-
await new Promise((resolve27) => setTimeout(resolve27,
|
|
85861
|
+
for (const delay3 of [0, 1e3, 2e3, 4e3, 8e3]) {
|
|
85862
|
+
if (delay3)
|
|
85863
|
+
await new Promise((resolve27) => setTimeout(resolve27, delay3));
|
|
85800
85864
|
const status = await client.call("GET", "/deploy/status", void 0, query, { timeoutMs: 2e3, refresh: false }).catch(() => null);
|
|
85801
85865
|
if (status?.deployment_outcome === "live" && status.verified === true && typeof status.release_id === "string" && status.release_id === status.active_release_id && status.project_id === projectId && typeof status.version === "number") {
|
|
85802
85866
|
return { ...status, has_functions: status.has_functions === true };
|
|
@@ -90680,18 +90744,18 @@ async function waitForPreviewJob(client, jobId, timeoutSeconds, firstDelayMs = 0
|
|
|
90680
90744
|
const startedAt = Date.now();
|
|
90681
90745
|
const deadline = startedAt + timeoutSeconds * 1e3;
|
|
90682
90746
|
let job;
|
|
90683
|
-
let
|
|
90747
|
+
let delay3 = firstDelayMs;
|
|
90684
90748
|
for (; ; ) {
|
|
90685
90749
|
const remaining = deadline - Date.now();
|
|
90686
|
-
if (
|
|
90750
|
+
if (delay3 >= remaining) {
|
|
90687
90751
|
if (remaining > 0)
|
|
90688
90752
|
await sleep2(remaining);
|
|
90689
90753
|
if (job)
|
|
90690
90754
|
return { job, timedOut: true };
|
|
90691
90755
|
throw new Error("The wait expired before the platform returned the preview job status.");
|
|
90692
90756
|
}
|
|
90693
|
-
if (
|
|
90694
|
-
await sleep2(
|
|
90757
|
+
if (delay3)
|
|
90758
|
+
await sleep2(delay3);
|
|
90695
90759
|
let retryAfter = 0;
|
|
90696
90760
|
try {
|
|
90697
90761
|
job = await client.call("GET", `/preview-tools/jobs/${encodeURIComponent(jobId)}`, void 0, void 0, {
|
|
@@ -90706,7 +90770,7 @@ async function waitForPreviewJob(client, jobId, timeoutSeconds, firstDelayMs = 0
|
|
|
90706
90770
|
throw error3;
|
|
90707
90771
|
retryAfter = Math.max(retryAfter, error3.meta.retryAfterMs);
|
|
90708
90772
|
}
|
|
90709
|
-
|
|
90773
|
+
delay3 = Math.max(jobPollDelay(Date.now() - startedAt), retryAfter);
|
|
90710
90774
|
}
|
|
90711
90775
|
}
|
|
90712
90776
|
var TERMINAL;
|
|
@@ -134402,16 +134466,16 @@ async function waitForJob(client, admitted, timeoutSeconds, firstDelayMs) {
|
|
|
134402
134466
|
const startedAt = Date.now();
|
|
134403
134467
|
const deadline = startedAt + timeoutSeconds * 1e3;
|
|
134404
134468
|
let job = admitted;
|
|
134405
|
-
let
|
|
134469
|
+
let delay3 = firstDelayMs;
|
|
134406
134470
|
for (; ; ) {
|
|
134407
134471
|
const remaining = deadline - Date.now();
|
|
134408
|
-
if (
|
|
134472
|
+
if (delay3 >= remaining) {
|
|
134409
134473
|
if (remaining > 0)
|
|
134410
134474
|
await sleep4(remaining);
|
|
134411
134475
|
return { job, timedOut: true };
|
|
134412
134476
|
}
|
|
134413
|
-
if (
|
|
134414
|
-
await sleep4(
|
|
134477
|
+
if (delay3)
|
|
134478
|
+
await sleep4(delay3);
|
|
134415
134479
|
let retryAfter;
|
|
134416
134480
|
try {
|
|
134417
134481
|
const view = jobView(await client.call("GET", path3, void 0, void 0, {
|
|
@@ -134428,7 +134492,7 @@ async function waitForJob(client, admitted, timeoutSeconds, firstDelayMs) {
|
|
|
134428
134492
|
throw error3;
|
|
134429
134493
|
retryAfter = Math.max(retryAfter ?? 0, hint ?? 0);
|
|
134430
134494
|
}
|
|
134431
|
-
|
|
134495
|
+
delay3 = Math.max(jobPollDelay(Date.now() - startedAt), retryAfter ?? 0);
|
|
134432
134496
|
}
|
|
134433
134497
|
}
|
|
134434
134498
|
function observedCronConfig(cron) {
|
|
@@ -136553,7 +136617,7 @@ var init_test_session = __esm({
|
|
|
136553
136617
|
// dist/lib/prepared-actor-session.js
|
|
136554
136618
|
import { createHash as createHash10 } from "node:crypto";
|
|
136555
136619
|
import { closeSync as closeSync6, openSync as openSync6, rmSync as rmSync16 } from "node:fs";
|
|
136556
|
-
import { setTimeout as
|
|
136620
|
+
import { setTimeout as delay2 } from "node:timers/promises";
|
|
136557
136621
|
async function preparedActorSession(root, target, name) {
|
|
136558
136622
|
const read = /* @__PURE__ */ __name(() => preparedActorState(root, target, name), "read");
|
|
136559
136623
|
const initial = read();
|
|
@@ -136572,7 +136636,7 @@ async function preparedActorSession(root, target, name) {
|
|
|
136572
136636
|
const latest = read();
|
|
136573
136637
|
if (!testAccessNeedsRefresh(latest.access))
|
|
136574
136638
|
return latest.access;
|
|
136575
|
-
await
|
|
136639
|
+
await delay2(100);
|
|
136576
136640
|
continue;
|
|
136577
136641
|
}
|
|
136578
136642
|
try {
|