mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 13:22:54 +00:00
nip71: fix feed hang — surface published_at so ingest skips history fetch
Deep dive into the "nothing loads / Fetching recent videos… hangs" symptom found the real blocker: it was NOT the moderation/WoT stage (that uses cached reads and passes unknown authors through clean). It was the feed's resolve-posted-at stage. resolveVideoPostedAt() short-circuits when a video has nip71.publishedAt, otherwise it does a per-video `nostrClient.hydrateVideoHistory()` network fetch (looking up kind-30078 history). Foreign NIP-71 videos have no such history, and the ingest adapter wasn't setting nip71.publishedAt — so a burst of ~32 ingested videos triggered ~32 blocking history fetches that stalled the render and flooded relays. Fix: the ingest adapter now surfaces nip71.publishedAt from the NIP-71 published_at tag (falling back to created_at). The feed short-circuits and never fetches history for ingested videos. Re-enables FEATURE_NIP71_INGEST by default now that the hang is addressed. Tests: adapter published_at extraction + created_at fallback; mutation-verified. 1237/1238 unit (known UploadModal flake). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
639d045e28
commit
96a985ce89
3 files changed
+36
-8
No files matched your search
@@ -56,6 +56,25 @@ test("maps a foreign NIP-71 event to a playable bitvid video", () => {
|
||||
assert.equal(v.isPrivate, false);
|
||||
});
|
||||
|
||||
test("surfaces nip71.publishedAt so the feed skips per-video history fetches", () => {
|
||||
// The published_at tag becomes nip71.publishedAt (feed resolve-posted-at uses
|
||||
// it to avoid a blocking kind-30078 history fetch per ingested video).
|
||||
const withPublished = buildVideoFromNip71Event(
|
||||
foreignEvent({
|
||||
tags: [
|
||||
["title", "Has published_at"],
|
||||
["published_at", "1700000123"],
|
||||
["imeta", "url https://example.com/v.mp4", "m video/mp4"],
|
||||
],
|
||||
}),
|
||||
);
|
||||
assert.equal(withPublished.nip71.publishedAt, 1700000123);
|
||||
|
||||
// Falls back to created_at when there's no published_at tag.
|
||||
const noPublished = buildVideoFromNip71Event(foreignEvent({ created_at: 1699999999 }));
|
||||
assert.equal(noPublished.nip71.publishedAt, 1699999999);
|
||||
});
|
||||
|
||||
test("content-warning maps to isNsfw so the NSFW gate applies", () => {
|
||||
const clean = buildVideoFromNip71Event(foreignEvent());
|
||||
assert.equal(clean.isNsfw, false);
|
||||
|
||||
Reference in new issue
Block a user