@ai-ecoverse/slicc-kernel 1.7.0 → 1.7.1
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/README.md +2 -2
- package/dist/index.js +33 -11
- package/dist/index.js.map +3 -3
- package/dist/kernel-worker.js +8 -4
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +2 -1
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +25 -4
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +2 -1
- package/dist/process-worker.js.map +2 -2
- package/package.json +2 -2
package/dist/node.js
CHANGED
|
@@ -3124,7 +3124,8 @@ var HttpHandles = class {
|
|
|
3124
3124
|
else entry.left = next.value;
|
|
3125
3125
|
} catch (e) {
|
|
3126
3126
|
entry.done = true;
|
|
3127
|
-
|
|
3127
|
+
const timedOut = e?.code === "ETIMEDOUT";
|
|
3128
|
+
return { ok: false, errno: timedOut ? "ETIMEDOUT" : "EIO", message: message(e) };
|
|
3128
3129
|
}
|
|
3129
3130
|
}
|
|
3130
3131
|
const bytes = entry.left.subarray(0, Math.max(0, max));
|
|
@@ -5760,6 +5761,26 @@ function signalNumber(name2) {
|
|
|
5760
5761
|
return SIG[key];
|
|
5761
5762
|
}
|
|
5762
5763
|
|
|
5764
|
+
// src/body-idle.ts
|
|
5765
|
+
var BODY_IDLE_MS = 5 * 60 * 1e3;
|
|
5766
|
+
function idleFailure(ms) {
|
|
5767
|
+
return Object.assign(new Error(`the response body sent no data for ${ms} ms`), {
|
|
5768
|
+
code: "ETIMEDOUT"
|
|
5769
|
+
});
|
|
5770
|
+
}
|
|
5771
|
+
async function readWithin(reader, ms) {
|
|
5772
|
+
if (!(ms > 0 && ms < Number.POSITIVE_INFINITY)) return reader.read();
|
|
5773
|
+
let timer;
|
|
5774
|
+
const idle = new Promise((_, reject) => {
|
|
5775
|
+
timer = setTimeout(() => reject(idleFailure(ms)), ms);
|
|
5776
|
+
});
|
|
5777
|
+
try {
|
|
5778
|
+
return await Promise.race([reader.read(), idle]);
|
|
5779
|
+
} finally {
|
|
5780
|
+
clearTimeout(timer);
|
|
5781
|
+
}
|
|
5782
|
+
}
|
|
5783
|
+
|
|
5763
5784
|
// src/transport.ts
|
|
5764
5785
|
var MAX_REQUEST_BODY = 64 * 1024 * 1024;
|
|
5765
5786
|
function joinHeaders(headers) {
|
|
@@ -5772,11 +5793,11 @@ function joinHeaders(headers) {
|
|
|
5772
5793
|
}
|
|
5773
5794
|
return out;
|
|
5774
5795
|
}
|
|
5775
|
-
async function* chunks(body) {
|
|
5796
|
+
async function* chunks(body, idleMs) {
|
|
5776
5797
|
if (!body) return;
|
|
5777
5798
|
const reader = body.getReader();
|
|
5778
5799
|
try {
|
|
5779
|
-
for (let next = await reader
|
|
5800
|
+
for (let next = await readWithin(reader, idleMs); !next.done; next = await readWithin(reader, idleMs)) {
|
|
5780
5801
|
if (next.value.byteLength > 0) yield next.value;
|
|
5781
5802
|
}
|
|
5782
5803
|
} finally {
|
|
@@ -5817,7 +5838,7 @@ function fetchTransport(options = {}) {
|
|
|
5817
5838
|
response.headers.forEach((value, name2) => {
|
|
5818
5839
|
headers.push([name2, value]);
|
|
5819
5840
|
});
|
|
5820
|
-
const body = chunks(response.body);
|
|
5841
|
+
const body = chunks(response.body, options.bodyIdleMs ?? BODY_IDLE_MS);
|
|
5821
5842
|
return {
|
|
5822
5843
|
status: response.status,
|
|
5823
5844
|
statusText: response.statusText,
|