Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Adding slots runs two queries per slot

Abierto
#373 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
sql, typescript
Área
backend, database

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
TypeScript
Estrellas
19
Forks
4
Merge medio
22 h 46 min
PR fusionados (30 d)
170

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de richshaw/OpenSignup

Todos los issues de richshaw/OpenSignup

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.