Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

AbortSignal is ignored while waiting for retry backoff

Aperta
#205 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@abhinavkr26104 ci sta già lavorando.

Dal 15/8/2026.

  • #210 di @abhinavkr26104 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
api

Direzione di ricerca

Inizia da retryRequest() in src/core.ts:595-630 e traccia come makeRequest() gestisce options.signal. Verifica la riproduzione fornita; il lavoro è completato quando l'annullamento durante il ritardo di 500 ms del tentativo successivo viene rifiutato prontamente con APIUserAbortError e il normale comportamento dei tentativi rimane intatto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

Aborting a request while it is waiting to retry does not interrupt the retry delay. The SDK waits for the full Retry-After/backoff period before it notices the signal is aborted.

retryRequest() uses an unconditional await sleep(timeoutMillis) at src/core.ts:595-630. The caller's options.signal is only checked when makeRequest() starts the next attempt.

Reproduction
import Browserbase from '@browserbasehq/sdk';

let attempts = 0;
const client = new Browserbase({
  apiKey: 'test',
  maxRetries: 1,
  fetch: async () => {
    attempts++;
    return new Response('{}', {
      status: attempts === 1 ? 429 : 200,
      headers: {
        'content-type': 'application/json',
        'retry-after-ms': '500',
      },
    });
  },
});

const controller = new AbortController();
const started = Date.now();
const request = client.get('/retry', { signal: controller.signal });
setTimeout(() => controller.abort(), 20);

await request.catch((error) => {
  console.log(error.constructor.name); // APIUserAbortError
  console.log(Date.now() - started);    // ~500 ms, not ~20 ms
});
Expected behavior

The retry wait is abortable, so the promise rejects with APIUserAbortError promptly after about 20 ms.

Actual behavior

The promise does not reject until the complete 500 ms retry delay has elapsed. A long server-provided Retry-After value makes cancellation ineffective for that entire period.

Why this matters

Abort signals are used to release work when requests, jobs, or incoming HTTP connections are canceled. Keeping canceled operations pending through retry delays wastes resources and makes shutdown/cancellation latency unpredictable. The delay should race against the signal and clean up its listener/timer on either outcome.

Tested against @browserbasehq/sdk 2.18.0 / current main (b781bd7).

Lingua principale
TypeScript
Stelle
65
Fork
17
Merge medio
16m
PR unite (30g)
2

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di browserbase/sdk-node

Tutte le issue di browserbase/sdk-node

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.