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

/events/past: 33 queries and ~466ms median per render

Cerrado
#2,887 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
58/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rails, ruby

Línea de trabajo

Comienza volviendo a medir GET /events/past y rastreando EventsController#past a través de paginated_events, load_events, fetch_past_events, EventPresenter.decorate_collection y EventCardComponent.with_collection. Captura las consultas durante la decoración y el renderizado, y luego verifica que mejoren el número de consultas y la duración mediana, mientras el orden de UNION y el comportamiento de ETag permanezcan sin cambios; compara los resultados con #2888.

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

Descripción

performance

Summary

GET /events/past (EventsController#past) takes a median 466ms per render (max 17.3s) and issues 33 queries (median db_runtime 80ms, view_runtime 118ms). The action sets an ETag via fresh_when, so conditional requests are cheap, but non-conditional clients (first visit, stale cache, most API clients) pay the full render every time.

The render path:

  1. paginated_events runs a UNION ALL across Workshops, Meetings, and Events, counts at the DB level, and returns only the 20 rows for the current page
  2. load_events runs three eager_load queries (workshops, meetings, events) for those rows
  3. fetch_past_events groups the rows by date and wraps each in a presenter (EventPresenter.decorate_collection)
  4. The view renders EventCardComponent.with_collection — each card is fragment-cached (event_card_component/* keys in Solid Cache)

33 queries is well over the handful that steps 1–2 need, so something in decoration or rendering loads associations the current eager loads don't cover.

Measured

3h window on 2026-09-16/17, from production canonical logs: 127 requests, median 466ms, max 17.3s. Stale by the time you read this — re-measure before starting.

Suggested directions

  1. Capture the 33 queries locally (Bullet or Prosopite against a production dump) and identify the associations touched during decoration and card rendering beyond the current eager_load calls
  2. Add the missing associations to the eager loads or batch them into a single preload, preserving the UNION order
  3. Check the hit rate on the per-event fragments before adding more caching — they may already absorb most of the view time

Verify

Query count and median duration drop; ETag behaviour unchanged.

Related

  • #2888 — the sibling /events/upcoming action, same code path; share findings
  • #2885 — same measurement window
Lenguaje dominante
Ruby
Estrellas
104
Forks
205
Merge medio
1 d 8 h
PR fusionados (30 d)
67

Guía de contribución

Abrir la guía de contribución

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 codebar/planner

Todos los issues de codebar/planner

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.