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

read-api: pass request.signal into Sheet.query/queryFirst/queryAll for client-disconnect cancellation

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript
領域
api, backend

調査の方向性

plans/read-api.md を読み、次に apps/api/src/services/*. 配下のルートハンドラーとサービスメソッドを調査します。既存の Sheet.query、queryFirst、queryAll の呼び出しを追跡し、影響を受ける各エントリポイントにリクエストシグナルを渡します。反復処理中に中断し、AbortError の理由を検証するユニットテストを追加します。

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

説明

gitsheets 1.0.5 shipped AbortSignal support on Sheet.query / queryFirst / queryAll (upstream #154). plans/read-api.md shipped before this was available, so our read services don't currently honor cancellation.

What

Thread request.signal (Fastify provides one when the client disconnects) into the Sheet.query calls in apps/api/src/services/* so a slow query for a disconnected client aborts at the next yield boundary instead of running to completion.

Why

At civic scale we won't hit it often, but a ?q=… over a large in-memory corpus could chew CPU after the user has navigated away. Free win for ~5 lines.

How

Each service method needs an AbortSignal parameter threaded from the route:

fastify.get('/api/projects', async (request) => {
  return projectService.list({ ...query, signal: request.raw.signal });
});
async list(opts: { signal?: AbortSignal, ...}) {
  for await (const project of this.sheet.query({ signal: opts.signal })) {
    // ...
  }
}

Tests: a unit test that aborts mid-iteration and asserts the AbortError reason matches.

Out of scope

  • The FTS engine's ?q=… path (better-sqlite3) doesn't expose an AbortSignal hook in its own API; cancellation there waits on a separate decision.
主要言語
TypeScript
スター
1
フォーク
1
平均マージ
1日 20時間
マージ済み PR(30日)
25

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

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

CodeForPhilly/codeforphilly-ng のほかの issue

CodeForPhilly/codeforphilly-ng の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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