fix(login-perf): kill relay REQ storms and feedback loops

Real-environment console logs revealed nip-07 login pegging the CPU and
starving encrypted-list decryption via relay REQ storms (~1000 REQ/s):

- moderationService.rebuildTrustedContacts emitted "contacts"
  unconditionally, forming an emit->fetch->emit loop (~1600 kind-3 REQ/s).
  Now emits only on actual change. Regression test added.
- Per-video live report (kind 1984) and view-count (kind 30079)
  subscriptions fan out O(videos x relays) and re-fire on every flaky-relay
  reconnect. Circuit-broken behind flags until batched (see refactor plan).
- onVideosShouldRefresh now coalesces forced reloads (2s leading-edge
  throttle) so list-change signals can't drive a reload loop.
- nip-07 queue reserves one foreground slot; DM decryption demoted to LOW
  so background DM backfill can't starve feed-driving lists. Test added.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.8 committed 2026-06-14 09:52:33 -04:00
1 parent 4bd9503caf
commit a3b205bfa1
7 files changed
+293 -5

No files matched your search

+5
View File
@@ -1151,6 +1151,11 @@ export class VideoListView {
}
ensureViewCountSubscription(pointerInfo) {
// CIRCUIT-BREAKER (confirmed against real env): one live kind-30079 view
// subscription per card, fanned across ~20 relays, contributed ~880 REQ/s.
// Disabled until batched into a single count query. See refactor plan.
return null;
// eslint-disable-next-line no-unreachable
if (!pointerInfo || !pointerInfo.key || !pointerInfo.pointer) {
return null;
}