Skip to content

Cache service body lookups to fix N+1 HTTP requests on admin events list#257

Merged
dgershman merged 2 commits intomainfrom
fix/cache-service-body-lookup
Mar 22, 2026
Merged

Cache service body lookups to fix N+1 HTTP requests on admin events list#257
dgershman merged 2 commits intomainfrom
fix/cache-service-body-lookup

Conversation

@dgershman
Copy link
Copy Markdown
Contributor

Summary

  • The service_body column in the admin events list was calling wp_remote_get() to the BMLT server for every single row. With ~150 events at ~1s per request, the page took minutes to load.
  • Added get_service_body_map() method that fetches once and caches via static variable (per-request) and WordPress transient (10 min TTL).
  • Simplified the column rendering to a simple map lookup.

Test plan

  • composer test passes (514 tests)
  • composer lint passes
  • Admin events list page loads in seconds instead of minutes with many events

🤖 Generated with Claude Code

The service_body column in the admin events list was calling wp_remote_get()
to the BMLT server for every single row. With ~150 events at ~1s per request,
the page took minutes to load. Now fetches once and caches via static variable
(per-request) and WordPress transient (10 min TTL).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dgershman dgershman closed this Mar 22, 2026
@dgershman dgershman reopened this Mar 22, 2026
… conflict

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dgershman dgershman merged commit d307bbf into main Mar 22, 2026
3 checks passed
@dgershman dgershman deleted the fix/cache-service-body-lookup branch March 22, 2026 17:25
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