perf(desktop): stop the Projects fan refetching on re-entry and running after leave - #6458
Conversation
54b8b0d to
77cac8a
Compare
Project enumeration is an exhaustive paginated relay scan and the work-items fan is five 2,000-event queries, yet their freshness windows (60s/30s, 10s for the local-repo filesystem scan) guaranteed a full refetch on nearly every Projects re-entry. Every local write path already invalidates its keys explicitly (issue/PR mutations, project creation, repo sync), so the short windows only served remote-actor freshness. Raise them (5m enumeration, 2m work items/activity/local repos) and keep the enumeration cached for 30m so re-entering Projects paints from cache instead of blocking on the scan. Signed-off-by: Max Lampert <maxwell@squareup.com>
77cac8a to
6e2809c
Compare
Leaving Projects used to leave the whole fan running: the project enumeration paginates the relay exhaustively, work items are five 2,000-event queries plus assignment-operation scans, and all of it competed with the next surface's channel fetches over the same relay connection. Thread AbortSignal through the enumeration and assignment pagination loops (additive optional params; behavior is unchanged without a signal) and cancel the fan's queries when ProjectsScreen unmounts. Cancellation only discards in-flight requests — cached data stays and the next visit refetches per staleTime. The enumeration key is shared with the project-detail screen, so it is cancelled only when no other observer holds it. Signed-off-by: Max Lampert <maxwell@squareup.com>
6e2809c to
0f83238
Compare
|
🤖 Comment from Maxwell's AI agent. Adversarial-review findings addressed in the latest push:
Tracked follow-up (deferred): the five eager 2,000-event queries are single bounded REQs that |
wesbillman
left a comment
There was a problem hiding this comment.
Carl, an automated reviewer, commenting via Wes’s GitHub account.
Reviewed exact head 0f832387d7adc8bf7b9cae84e2029973793e6c51 against GitHub-stated base aeb741fd31044ec560d953b0986dec2e7e93e2c6 (merge base 24ec6a468ec9d0d425ee58fbfc4d416412c446ad). No blocking lifecycle or cache defect found. Overview leave cancels the work-item prefix without killing the sidebar-owned project enumeration, cancellation preserves prior cache and remains cooperative at pagination boundaries, repository-address keying closes attach/detach reuse, and reconnect invalidation covers work items. Focused abort/enumeration/reconnect validation passed 22/22; exact-head CI is green and the diff check was clean.
* origin/main: (65 commits) fix(composer): preserve caret when inserting mentions mid-message (#6531) chore(deps): update rust crate async-trait to v0.1.92 (#6094) chore(deps): update dependency sonner to v2.0.8 (#6093) chore(deps): update rust crate http-body-util to v0.1.4 (#5452) chore(deps): update rust crate http to v1.4.2 (#5451) chore(deps): update rust crate futures-util to v0.3.33 (#5448) chore(deps): update rust crate futures to v0.3.33 (#5445) chore(deps): update dependency @tauri-apps/api to v2.11.1 (#5444) chore(deps): update ubuntu:24.04 docker digest to 561618e (#5442) chore(deps): update swatinem/rust-cache digest to 6323deb (#5441) fix(desktop): restore true zoom by scaling the root rem (#6514) chore(desktop): drop unused ORIGINAL_CONTENT from empty-edit-delete spec (#6517) feat(workflows): clarify workflow setup and activation (#6470) perf(desktop): stop the Projects fan refetching on re-entry and running after leave (#6458) perf(desktop): keep the member roster off the channel-switch path (#6456) fix(deletion): allow IRSA S3 credentials (#6495) docs(nips): comprehensive NIP-FI — core + claimable profiles (EDGE/LIFECYCLE/DELEG/CONF) (#5946) fix(benchmarks): wait for scripted event delivery (#6487) Polish mobile channel navigation and message sends (#6488) Clarify huddle message destination (#6496) ... Signed-off-by: leader <71e9f2c44a6932b6772caaaccda1911d010463c3e2c6c40410b8329956046801@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> Signed-off-by: Tom Brow <tomb@block.xyz>
…ifications-pr * origin/main: (38 commits) fix(composer): preserve caret when inserting mentions mid-message (#6531) chore(deps): update rust crate async-trait to v0.1.92 (#6094) chore(deps): update dependency sonner to v2.0.8 (#6093) chore(deps): update rust crate http-body-util to v0.1.4 (#5452) chore(deps): update rust crate http to v1.4.2 (#5451) chore(deps): update rust crate futures-util to v0.3.33 (#5448) chore(deps): update rust crate futures to v0.3.33 (#5445) chore(deps): update dependency @tauri-apps/api to v2.11.1 (#5444) chore(deps): update ubuntu:24.04 docker digest to 561618e (#5442) chore(deps): update swatinem/rust-cache digest to 6323deb (#5441) fix(desktop): restore true zoom by scaling the root rem (#6514) chore(desktop): drop unused ORIGINAL_CONTENT from empty-edit-delete spec (#6517) feat(workflows): clarify workflow setup and activation (#6470) perf(desktop): stop the Projects fan refetching on re-entry and running after leave (#6458) perf(desktop): keep the member roster off the channel-switch path (#6456) fix(deletion): allow IRSA S3 credentials (#6495) docs(nips): comprehensive NIP-FI — core + claimable profiles (EDGE/LIFECYCLE/DELEG/CONF) (#5946) fix(benchmarks): wait for scripted event delivery (#6487) Polish mobile channel navigation and message sends (#6488) Clarify huddle message destination (#6496) ... Signed-off-by: Tom Brow <tomb@block.xyz>
Entering Projects fires a large fan: an exhaustive paginated relay enumeration (projects/repos/tombstones), five 2,000-event work-item queries plus assignment-operation scans, per-repo activity summaries, and a local-repository filesystem scan. Measured on a large community (101 issues / 258 PRs):
Two lifecycle bugs made the fan far more expensive than it needs to be:
Abort behavior is covered by red-first unit tests on both pagination loops. Remaining follow-up (out of scope): the queries themselves want a relay-side aggregate instead of shipping thousands of events to compute counts client-side.