/events/past: 33 queries and ~466ms median per render
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
- Ambito
- backend, performance
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
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:
paginated_eventsruns a UNION ALL across Workshops, Meetings, and Events, counts at the DB level, and returns only the 20 rows for the current pageload_eventsruns threeeager_loadqueries (workshops, meetings, events) for those rowsfetch_past_eventsgroups the rows by date and wraps each in a presenter (EventPresenter.decorate_collection)- 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
- 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_loadcalls - Add the missing associations to the eager loads or batch them into a single preload, preserving the UNION order
- 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/upcomingaction, 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di codebar/planner
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Clean up historical duplicate invitation rows (one member, two invitations per event/workshop) Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
good first issue performance
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
Tutte le issue di codebar/planner
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
simp/pupmod-simp-simp#395 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
simp/pupmod-simp-rsyslog#219 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
simp/pupmod-simp-pupmod#256 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
simp/pupmod-simp-sudo#150 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100