Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#2,976 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
42/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rails, ruby
Lĩnh vực
backend, performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Ruby
Star
105
Fork
206
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
74

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của codebar/planner

Tất cả issue của codebar/planner

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.