Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

perf(sources): return listings before artwork loads and reuse connections

merged
#702 opened by devperf/streaming-listing-speed→main
Conversation4
devopened this pull requestAuthor· 2 weeks ago
Commits
0
Files changed…

Summary

Opening a source list was much slower than the API behind it. Listings downloaded every track and playlist cover one at a time, each over a new TLS connection, before returning anything. A 30-result search took 11–16 s and a NetEase playlist page about a minute; the same API answers in about 1 s with curl.

Changes

  • Listings now return as soon as the source answers. cover_url becomes a host artwork key; the webview loads visible covers in parallel through a new source-art protocol that serves the on-disk cache or downloads with load_resource under the source's resource origins. Descriptor headers stay in the host. CSP allows the scheme for images only.
  • Source requests and resource downloads share one pooled HTTP client, so repeated calls to the same service reuse their connection. Its DNS resolver refuses any name that resolves to a non-public address (previously enforced by resolving per request).
  • Contracts updated in catalog.md and source-host.md.

Measurements

Release build, macOS, same network and accounts, time from click to the list rendering:

ActionBeforeAfter
NetEase playlists (cold source)~60 s2.6 s
NetEase liked songs (3,000+)~90 s2.2 s
NetEase search11–16 s1.9 s
Bilibili favorites folder (371 items)>40 s1.7 s
Bilibili search—1.9 s
QQ Music search~10 s1.5 s

For reference, one request with curl: 0.4–1.4 s. A fresh reqwest client costs ~0.7 s per request against ~0.15 s on a reused connection.

Bilibili search in the release build after the change (covers load in after the list):

Bilibili search

Test plan

  • cargo test --release --lib -- source_host catalog: all pass; redirect_set_cookies_are_redacted_before_the_body_is_logged fails only when run together with other tests because of the global logger, also on main, and passes alone
  • cargo clippy --release --lib --tests: clean
  • New tests: artwork keys depend only on source, URL and headers; image type sniffing; the shared resolver refuses localhost; an unreachable cover fails at load time, not in the listing
  • pnpm exec vp test run for StreamingCover
  • Release app with real NetEase, Bilibili and QQ Music accounts (timings above)
  • Security profile: covers still only load from the source's declared resource origins over public HTTPS; the webview never sees descriptor headers

claude.ai/code/session_01N6gLNB1dzAQCEYjvHhcRPV

coderabbitai[bot]commented· 2 weeks ago

[!WARNING]

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: thedavidweng/OpenKara
  • Branch: perf/streaming-listing-speed
  • File: .coderabbit.yaml
  • Commit: 95f057f
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 164c5194-5000-4611-a531-25f92beae396
Commits

Reviewing files that changed from the base of the PR and between c5343ea641816113602b6986f09b1655e78b6556 and 95f057f785c14ebd38c2885d9879cc8dab7600c5.

Files selected for processing: 13

  • docs/references/contracts/catalog.md
  • docs/references/contracts/source-host.md
  • src-tauri/src/catalog/artwork.rs
  • src-tauri/src/catalog/mod.rs
  • src-tauri/src/catalog/plugin.rs
  • src-tauri/src/catalog/plugin_tests.rs
  • src-tauri/src/commands/catalog.rs
  • src-tauri/src/lib.rs
  • src-tauri/src/source_host/network.rs
  • src-tauri/tauri.conf.json
  • src/components/Catalog/StreamingCover.test.tsx
  • src/components/Catalog/StreamingCover.tsx
  • src/types/ipc.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
github-actions[bot]commented· 2 weeks ago

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 85% (🎯 65%) 9342 / 10990
🟢 Statements 84.15% (🎯 65%) 9997 / 11879
🟢 Functions 81.76% (🎯 60%) 2457 / 3005
🟢 Branches 76.9% (🎯 60%) 5864 / 7625
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src-tauri/tauri.conf.json 100% 100% 100% 100%
src/components/Catalog/StreamingCover.tsx 100% 77.77% 100% 100%
Generated in workflow #2413 for commit 95f057f by the Vitest Coverage Report Action
codecov[bot]commented· 2 weeks ago

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 88.0%. Comparing base (c5343ea) to head (95f057f). :white_check_mark: All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #702     +/-   ##
=======================================
- Coverage   88.0%   88.0%   -0.1%
=======================================
  Files        240     240
  Lines      13938   13938
  Branches    4742    4742
=======================================
- Hits       12269   12268      -1
- Misses      1579    1580      +1
  Partials      90      90
FlagCoverage Δ
frontend88.0% <100.0%> (-0.1%):arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

ComponentsCoverage Δ
frontend88.0% <100.0%> (-0.1%):arrow_down:
rust∅ <ø> (∅)
Files with missing linesCoverage Δ
src/components/Catalog/StreamingCover.tsx94.4% <100.0%> (ø)

... and 1 file with indirect coverage changes

:rocket: New features to boost your workflow:
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
kilo-code-bot[bot]commented· 2 weeks ago

Code Review Summary

This review did not finish. The model reached its output limit before it could write the review — a reasoning model can spend the whole budget thinking. Re-run the review, or lower the model's thinking effort, and it should get further. Any inline comments below are from an earlier review.

Sign in to comment.

Merge readiness

Checking mergeability after the indexing worker computes the current branch state.

Autopilot

Debug

Reviews

Approved0
ReviewersNone yet

Configure an OpenRouter key in repository settings.