Repository navigation
perf(api): cache and opt in to comment reaction reads - #366
Merged
Merged
Conversation
The item view re-reads grouped reactions on every comment feed page, and the
SSE reconcile re-fetches every loaded page, so a comment table read rode
along on each one. Serve grouped reactions from a short-TTL process cache
invalidated by reaction writes and comment deletes, and make hydration
opt-in so feeds that never render chips skip the read entirely.
- comment_reactions reads now consult a per-comment cache (5s TTL, bounded
entries). AddReaction, RemoveReaction, and comment deletion invalidate the
entry; the TTL only bounds staleness across processes.
- GET /items/{item_id}/comments, GET /comments/{comment_id}, and
PATCH /comments/{comment_id} attach reactions only when include_reactions
is true; POST /comments/batch takes the same opt-in field. The comment UI
opts in; other consumers no longer pay for it.
|
Size Change: 0 B 🆕 Total Size: 0 B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #364. The item view re-reads grouped reactions on every comment feed page, and the SSE reconcile re-fetches every loaded page, so a
comment_reactionsread rode along on each one. This cuts that read two ways.Short-TTL cache
comment_reactionsreads now consult a per-comment process cache (5s TTL, 20k entries) keyed by comment ID.AddReaction,RemoveReaction, and comment deletion invalidate the affected entry, so writes are visible immediately in the process that made them. The TTL only bounds staleness for other processes in a multi-instance deployment. Reads are already one batchedINquery per page; the cache removes the repeated reads during reconcile.Opt-in hydration
Reactions are attached only when the caller asks:
GET /items/{item_id}/comments?include_reactions=trueGET /comments/{comment_id}?include_reactions=truePATCH /comments/{comment_id}?include_reactions=truePOST /comments/batchwith"include_reactions": trueThe comment UI opts in on its feed calls. Other consumers (the item-split dialog, API clients that do not render chips, the board batch path) no longer pay for the read. Default behaviour is now "no reactions in the payload".
api/openapi-v2.jsonandinternal/restapi/v2/contract-metadata.jsonwere regenerated.Test plan:
go build ./...,gofmt,golangci-lint runoninternal/servicesandinternal/restapi/v2.svelte-checkguards; Biome on the changed non-Svelte file.-run 'TestCommentReaction|TestV2CommentReactions'on SQLite and PostgreSQL, plus the fullinternal/restapi/v2package and theCommentsuite intests/.src/lib/api/(29 files, 467 tests) and the comments/reactions component tests.Companion test PR: Windshiftapp/core-tests-internal#5.