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

Adding slots runs two queries per slot

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

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
sql, typescript
Ambito
backend, database

Direzione di ricerca

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.

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

Descrizione

enhancement

What happens

addSlot, addSlotsBulk and createSignup each loop over the rows. For each row they:

  1. run extractSlotAt
  2. run pickAvailableRef, which does a SELECT per attempt
  3. 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_unique constraint stays as the safety net.

  • addSlot becomes a thin call into the bulk path, keeping its capacity default of 1.

  • createSignup inserts its fields in one statement.

  • Use the ids made in code, not the order RETURNING gives back, for the beforeSlotId splice.

Watch for

  • A single add's activity payload becomes the bulk shape, { count, bulk: true, slotIds }. Nothing reads it, but docs/telemetry.md describes 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.ts and the MCP tools.db.test.ts pass.
  • pnpm lint && pnpm typecheck && pnpm knip && pnpm test && pnpm test:db pass.
Lingua principale
TypeScript
Stelle
19
Fork
4
Merge medio
22h 10m
PR unite (30g)
168

Preparare l'ambiente

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 richshaw/OpenSignup

Tutte le issue di richshaw/OpenSignup

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.