Skip to content

Cut per-request work on the schedule and all events pages - #429

Merged
cycomachead merged 2 commits into
mainfrom
schedule-page-cache
Nov 2, 2026
Merged

cycomachead merged 2 commits into
mainfrom
schedule-page-cache

Conversation

@cycomachead

Copy link
Copy Markdown
Member

From the memory audit. Production profile: /schedule costs ~244k allocations cold / 46k warm; /schedule/events 437k / 65k.

Schedule page (/schedule)

  • Every request loaded the cached event schedule records, which deserializes the whole object graph, and rebuilt the FullCalendar JSON from them. Program#fullcalendar_events_json now caches the JSON string, with the same cache key as before (program + selected schedule version), so a hit is one string read.
  • Removed the view's fragment cache. Its key included that JSON, so it never skipped any work. It also contained @now, so it served a stale "now" marker.
  • Breaks span all rooms; the formatter now looks up the room guids once per page instead of once per break.
  • The XML and iCal formats are unchanged. The unreachable "redirect if no schedule" branch is gone; that value was always an array.

Personal schedule (favourites=true)

  • User#planned_event_ids returns the user's favourited, speaking and volunteering event ids in two queries. It replaces Event#planned_for_user? (three queries per event) on the schedule and all events pages. A spec checks it matches planned_for_user?.

All events (/schedule/events)

  • Unscheduled events use where.not(id: ...) instead of loading every confirmed event and subtracting arrays.

Related: #427 makes the event cards on this page shareable in the cache for signed-in users. #426 touches happening_now; this PR leaves that action alone to avoid conflicts.

Tests: new controller specs for the schedule JSON (all vs favourites) and the events page (scheduled/unscheduled, favourites), plus model specs. Schedule, program, formatter and feature specs and all Cucumber scenarios pass. .rubocop_todo.yml raises Metrics/ClassLength for User by 4 lines.

🤖 Generated with Claude Code

cycomachead and others added 2 commits October 31, 2026 01:17
- Schedule page: cache the FullCalendar JSON string (Program#fullcalendar
  _events_json) instead of building it from cached records on every
  request. Drop the view fragment cache: its key included that JSON, so
  it never saved work, and it froze the "now" marker for the cache's life.
- Breaks look up the venue's room guids once, not once per break.
- Personal schedule: User#planned_event_ids gets the user's favourited,
  speaking and volunteering event ids in two queries, replacing
  Event#planned_for_user? (three queries per event).
- All events: find unscheduled events with where.not instead of loading
  every confirmed event and subtracting arrays.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* origin/main:
  Render iCal feeds as plain text/calendar responses
  Paginate admin revision history and trim admin events preloads
  Load nav conference links with SQL instead of per-conference can?
  Share cached event cards between viewers who see the same card
  Find happening now sessions in SQL with HappeningNowQuery

# Conflicts:
#	spec/controllers/schedules_controller_spec.rb
@cycomachead
cycomachead merged commit 6c68816 into main Nov 2, 2026
16 checks passed
@cycomachead
cycomachead deleted the schedule-page-cache branch November 2, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant