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

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

Chiusa
#2,887 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rails, ruby

Direzione di ricerca

Inizia rimisurando GET /events/past e tracciando EventsController#past attraverso paginated_events, load_events, fetch_past_events, EventPresenter.decorate_collection e EventCardComponent.with_collection. Acquisisci le query durante la decorazione e il rendering, quindi verifica che il numero di query e la durata mediana migliorino, mentre l’ordine di UNION e il comportamento di ETag rimangano invariati; confronta i risultati con #2888.

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

Descrizione

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
Lingua principale
Ruby
Stelle
104
Fork
205
Merge medio
1g 8h
PR unite (30g)
67

Guida per i contributori

Apri la guida per i contributori

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

Tutte le issue di codebar/planner

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.