Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Page-level fragment for /events/past: skip the fetch pipeline on cache hits

Ouverte
#2,976 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
42/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
rails, ruby
Domaine
backend, performance

Piste de recherche

Start at the controller action for GET /events/past and the view's existing list, pagination, ETag, and card-fragment code; compare them with the prototype on the measurement branch. Review deletion staleness and html_safe handling before settling the cache key. Done means cold HTML remains byte-identical, warm requests use the page fragment with one MAX(updated_at) query, and the chosen invalidation semantics are explicit.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

A benchmarked prototype cut the steady-state (warm-fragment) cost of GET /events/past by 84% (43,426 -> 7,104 GC objects per request) and its queries from 6 to 1 by serving the whole list from one page-level fragment: on a hit, the controller skips the COUNT, the eager loads, the decoration and the render entirely; only the ETag's MAX(updated_at) query runs.

Today each card fragment is checked after the pipeline has already loaded and decorated all 20 records, so warm requests pay the full fetch cost to render from cache.

Prototype shape (verified: cold HTML byte-identical, warm fragment serves the full card set)
  • Key: ['events/past-page', I18n.locale, params[:page].to_i, MAX(updated_at) etag source]
  • Controller: read_fragment on that key before fetch_past_events; on a hit, the view outputs the stored HTML
  • View: cache(..., skip_digest: true) around the existing list + pagination markup
  • Measured: warm 43,426 -> 7,104 allocations (−84%), cold 73,401 -> 73,803 (+0.5%, the extra page write), cold rendered HTML identical

The prototype diff exists on the measurement branch and can be revived on request.

Staleness semantics to review before shipping: the key inherits the same exposure as the existing ETag and card fragments — record deletions do not bump MAX(updated_at), so a deleted event stays visible until another tracked table row is touched. Whether that is acceptable (and whether the key should incorporate a tombstone counter or shorter horizon) is the main design question. The stored HTML is output with html_safe, standard for view fragments but worth an explicit look.

Langage dominant
Ruby
Étoiles
106
Forks
208
Merge moyen
19 h 31 min
PR mergées (30 j)
84

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de codebar/planner

Toutes les issues de codebar/planner

Issues similaires

Plus d'issues Ruby

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.