@oh-my-pi/pi-utils 17.3.0 → 17.3.2
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 +6 -0
- package/dist/types/ptree.d.ts +1 -1
- package/package.json +2 -2
- package/src/fetch-retry.ts +11 -2
- package/src/ptree.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [17.3.2] - 2026-08-13
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Fixed `fetchWithRetry()` aborts during retry backoff to preserve the documented `"Request was aborted"` error contract ([#8450](https://github.com/can1357/oh-my-pi/issues/8450)).
|
|
10
|
+
|
|
5
11
|
## [17.3.0] - 2026-08-13
|
|
6
12
|
|
|
7
13
|
### Fixed
|
package/dist/types/ptree.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export declare class ChildProcess<In extends InMask = InMask> {
|
|
|
78
78
|
/** Returns the truncated stderr tail (last 32KB). */
|
|
79
79
|
peekStderr(): string;
|
|
80
80
|
nothrow(): this;
|
|
81
|
-
kill(reason?: Exception): void;
|
|
81
|
+
kill(reason?: Exception, gracefulMs?: number): void;
|
|
82
82
|
text(): Promise<string>;
|
|
83
83
|
blob(): Promise<Blob>;
|
|
84
84
|
json(): Promise<unknown>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-utils",
|
|
4
|
-
"version": "17.3.
|
|
4
|
+
"version": "17.3.2",
|
|
5
5
|
"description": "Shared utilities for pi packages",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"fmt": "biome format --write ."
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@oh-my-pi/pi-natives": "17.3.
|
|
34
|
+
"@oh-my-pi/pi-natives": "17.3.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/bun": "^1.3.14"
|
package/src/fetch-retry.ts
CHANGED
|
@@ -220,7 +220,7 @@ export async function fetchWithRetry(
|
|
|
220
220
|
if (signal?.aborted) throw new Error("Request was aborted");
|
|
221
221
|
const wrapped = wrapNetworkError(error);
|
|
222
222
|
if (attempt + 1 >= maxAttempts) throw wrapped;
|
|
223
|
-
await
|
|
223
|
+
await waitForRetry(resolveDefaultDelay(defaultDelayMs, attempt, maxDelayMs), signal);
|
|
224
224
|
continue;
|
|
225
225
|
}
|
|
226
226
|
|
|
@@ -234,7 +234,7 @@ export async function fetchWithRetry(
|
|
|
234
234
|
if (hint !== undefined && hint > maxDelayMs) return response;
|
|
235
235
|
|
|
236
236
|
const delayMs = Math.min(hint ?? resolveDefaultDelay(defaultDelayMs, attempt, maxDelayMs), maxDelayMs);
|
|
237
|
-
await
|
|
237
|
+
await waitForRetry(delayMs, signal);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -251,6 +251,15 @@ function mergeInit(base: RequestInit, overlay: RequestInit, timeout: number | fa
|
|
|
251
251
|
return merged;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
async function waitForRetry(delayMs: number, signal: AbortSignal | undefined): Promise<void> {
|
|
255
|
+
try {
|
|
256
|
+
await scheduler.wait(delayMs, { signal });
|
|
257
|
+
} catch (error) {
|
|
258
|
+
if (signal?.aborted) throw new Error("Request was aborted");
|
|
259
|
+
throw error;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
254
263
|
function wrapNetworkError(error: unknown): Error {
|
|
255
264
|
if (error instanceof Error) {
|
|
256
265
|
if (error.name === "AbortError" || error.message === "Request was aborted") {
|
package/src/ptree.ts
CHANGED
|
@@ -217,11 +217,11 @@ export class ChildProcess<In extends InMask = InMask> {
|
|
|
217
217
|
return this;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
kill(reason?: Exception) {
|
|
220
|
+
kill(reason?: Exception, gracefulMs?: number) {
|
|
221
221
|
if (reason && !this.#exitReasonPending) this.#exitReasonPending = reason;
|
|
222
222
|
if (!this.proc.killed)
|
|
223
223
|
void Process.fromPid(this.proc.pid)
|
|
224
|
-
?.terminate()
|
|
224
|
+
?.terminate(gracefulMs === undefined ? undefined : { gracefulMs })
|
|
225
225
|
?.catch(e => void e);
|
|
226
226
|
}
|
|
227
227
|
|