read-api: pass request.signal into Sheet.query/queryFirst/queryAll for client-disconnect cancellation
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- typescript
調査の方向性
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
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CodeForPhilly/codeforphilly-ng のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
MarkdownEditor toolbar: use Radix Toolbar from radix-ui instead of the hand-rolled roving tabindex オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
CodeForPhilly/codeforphilly-ng の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
TanStack/tanstack.com#1293 ·