Skip to content

Commit 93a665e

Browse files
fix: create fresh AbortSignal per retry attempt to prevent stale timeout
Co-Authored-By: Chris K <ckorhonen@gmail.com>
1 parent 988e9fd commit 93a665e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/client.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export class OpenSeaClient {
6464
Accept: "application/json",
6565
"x-api-key": this.apiKey,
6666
},
67-
signal: AbortSignal.timeout(this.timeoutMs),
6867
},
6968
path,
7069
)
@@ -106,7 +105,6 @@ export class OpenSeaClient {
106105
method: "POST",
107106
headers,
108107
body: body ? JSON.stringify(body) : undefined,
109-
signal: AbortSignal.timeout(this.timeoutMs),
110108
},
111109
path,
112110
)
@@ -124,7 +122,10 @@ export class OpenSeaClient {
124122
path: string,
125123
): Promise<Response> {
126124
for (let attempt = 0; ; attempt++) {
127-
const response = await fetch(url, init)
125+
const response = await fetch(url, {
126+
...init,
127+
signal: AbortSignal.timeout(this.timeoutMs),
128+
})
128129

129130
if (this.verbose) {
130131
console.error(`[verbose] ${response.status} ${response.statusText}`)

0 commit comments

Comments
 (0)