[playlists] Speed up the project playlist endpoint#1108
Merged
Conversation
Annotation JSONB blobs are the heaviest part of a playlist and are now loaded on demand by the web client. Make their inclusion opt-in (with_annotations, default True) and have the logged-in project playlist endpoint opt out. The shared/guest path keeps the default so the guest player, which has no lazy-loading, still receives annotations inline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
set_preview_files_for_entities loaded full PreviewFile ORM objects for every revision of every entity (~7k rows for a 400-shot playlist), then serialized the whole enriched dict a second time. Hydrating that many ORM instances dominated the request (it was the bulk of the ~1.8s server time together with the heavy JSONB columns). - Select only the scalar columns we serialize, as Row tuples, skipping ORM hydration and the heavy `annotations`/`data` JSONB (annotations only when the caller asked for them). Mirrors get_preview_files_for_entity(). - Drop the redundant final serialize_value() pass: the dict is already JSON-safe (playlist.serialize() + BuildJob.present() + per-row serialized values). Server time for a 414-shot / ~7k-revision playlist dropped from ~1.8s to ~0.1s (with the earlier annotation-blob removal). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problems
Solutions