Adding slots runs two queries per slot
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- sql, typescript
调研方向
Start with the three loops in addSlot, addSlotsBulk and createSignup, plus extractSlotAt and pickAvailableRef, and check how the signup lock is held. The work depends on #372 (withSignupWriteLock), so confirm that lands first. Done means a 500-row bulk add runs a fixed number of statements, pinned by a test, while slots.db.test.ts, signups.db.test.ts and the MCP tools.db.test.ts pass, and docs/telemetry.md reflects the new activity payload.
由索引模型根据 Issue 内容生成。
描述
What happens
addSlot, addSlotsBulk and createSignup each loop over the rows. For each row they:
- run
extractSlotAt - run
pickAvailableRef, which does a SELECT per attempt - do a one-row INSERT
That is about 2N statements for N slots. A 500-row bulk add, or an add_slots call of that size, runs about 1,000, all while holding the signup lock.
createSignup also inserts its fields one at a time. The three loops are nearly the same code.
Fix, in outline
-
One
insertSlots(tx, signup, fields, rows)that:- reads the signup's existing refs once
- picks the new refs in memory
- does one multi-row INSERT
Every caller already holds the signup lock, or owns a signup nobody else can see yet. The
slots_ref_uniqueconstraint stays as the safety net. -
addSlotbecomes a thin call into the bulk path, keeping its capacity default of 1. -
createSignupinserts its fields in one statement. -
Use the ids made in code, not the order RETURNING gives back, for the
beforeSlotIdsplice.
Watch for
- A single add's activity payload becomes the bulk shape,
{ count, bulk: true, slotIds }. Nothing reads it, butdocs/telemetry.mddescribes both shapes (after #356), so update it. - The format of the ref suffix may change. Refs are internal and never shown.
Order
After #372, which adds withSignupWriteLock.
Done when
- A 500-row bulk add runs a fixed number of statements, pinned by a test.
slots.db.test.ts,signups.db.test.tsand the MCPtools.db.test.tspass.pnpm lint && pnpm typecheck && pnpm knip && pnpm test && pnpm test:dbpass.
- 主要语言
- TypeScript
- 星标
- 19
- 派生
- 4
- 平均合并
- 23 小时 28 分钟
- 30 天内合并 PR
- 173
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
richshaw/OpenSignup 的其他 Issue
-
bug pipeline:ready pipeline:ux
难度 2/5 1-3 小时 新手友好度 90/100
richshaw/OpenSignup#723 ·
维护者通常 1 天内回复
-
bug pipeline:ready pipeline:ux
难度 2/5 1-3 小时 新手友好度 85/100
richshaw/OpenSignup#722 ·
维护者通常 1 天内回复
-
Magic Compose calls fields "columns" on the draft banner, the drafting screen and its warnings可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug pipeline:ready pipeline:ux
难度 2/5 1-3 小时 新手友好度 85/100
richshaw/OpenSignup#719 ·
维护者通常 1 天内回复
-
The "You're in." confirmation doesn't say which email address it used可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭enhancement pipeline:ready pipeline:ux
难度 2/5 1-3 小时 新手友好度 85/100
richshaw/OpenSignup#715 ·
维护者通常 1 天内回复
-
The privacy and cookies pages don't mention three things the app stores可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug pipeline:ready pipeline:ux
难度 2/5 1-3 小时 新手友好度 75/100
richshaw/OpenSignup#711 ·
维护者通常 1 天内回复
查看 richshaw/OpenSignup 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
excaliburjs/Excalibur#3895 ·
维护者通常 3 天内回复
-
infer_audio_type only recognises one MPEG Layer III frame header, so most MP3 files are rejected可能已有人在做 @Steve-20-ai 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Earn report crashes with "RangeError: Invalid time value" when a report row has an unparsable timestamp可能已有人在做 @Gurkaran18 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
joinmarket-webui/jam#1588 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
mihaip/infinite-mac#475 ·