@meistrari/sandbox-sdk 1.0.5 → 1.0.6
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.cjs +7 -1
- package/dist/index.mjs +7 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -292,12 +292,18 @@ class SandboxClient {
|
|
|
292
292
|
let receivedDone = false;
|
|
293
293
|
let stdoutCharsEmitted = 0;
|
|
294
294
|
let stderrCharsEmitted = 0;
|
|
295
|
+
const streamStartMs = Date.now();
|
|
296
|
+
const timeoutMs = this.timeout;
|
|
295
297
|
const recoverViaPolling = async function* (client, runId, stdoutOffset, stderrOffset) {
|
|
296
298
|
let run;
|
|
297
299
|
try {
|
|
298
300
|
run = await client.getRun(runId);
|
|
299
301
|
if (!run.isComplete) {
|
|
300
|
-
|
|
302
|
+
const elapsedMs = Date.now() - streamStartMs;
|
|
303
|
+
const remainingMs = timeoutMs - elapsedMs;
|
|
304
|
+
const intervalMs = 500;
|
|
305
|
+
const maxAttempts = Math.max(1, Math.floor(remainingMs / intervalMs));
|
|
306
|
+
run = await run.waitForCompletion({ intervalMs, maxAttempts });
|
|
301
307
|
}
|
|
302
308
|
} catch (pollError) {
|
|
303
309
|
yield {
|
package/dist/index.mjs
CHANGED
|
@@ -290,12 +290,18 @@ class SandboxClient {
|
|
|
290
290
|
let receivedDone = false;
|
|
291
291
|
let stdoutCharsEmitted = 0;
|
|
292
292
|
let stderrCharsEmitted = 0;
|
|
293
|
+
const streamStartMs = Date.now();
|
|
294
|
+
const timeoutMs = this.timeout;
|
|
293
295
|
const recoverViaPolling = async function* (client, runId, stdoutOffset, stderrOffset) {
|
|
294
296
|
let run;
|
|
295
297
|
try {
|
|
296
298
|
run = await client.getRun(runId);
|
|
297
299
|
if (!run.isComplete) {
|
|
298
|
-
|
|
300
|
+
const elapsedMs = Date.now() - streamStartMs;
|
|
301
|
+
const remainingMs = timeoutMs - elapsedMs;
|
|
302
|
+
const intervalMs = 500;
|
|
303
|
+
const maxAttempts = Math.max(1, Math.floor(remainingMs / intervalMs));
|
|
304
|
+
run = await run.waitForCompletion({ intervalMs, maxAttempts });
|
|
299
305
|
}
|
|
300
306
|
} catch (pollError) {
|
|
301
307
|
yield {
|