Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

AbortSignal is ignored while waiting for retry backoff

オープン
#205 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
typescript
領域
api

調査の方向性

src/core.ts:595-630 の retryRequest() から始め、makeRequest() が options.signal をどのように処理しているかを追跡します。提供された再現手順を確認します。500 ms の再試行遅延中に中止すると APIUserAbortError ですぐに reject され、通常の再試行動作が維持されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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).

主要言語
TypeScript
スター
64
フォーク
17
平均マージ
13分
マージ済み PR(30日)
4

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

browserbase/sdk-node のほかの issue

browserbase/sdk-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。