mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-04 20:02:26 +00:00
perf: Batch video timestamp resolution to reduce N+1 network requests
- Implemented `hydrateVideoHistoryBatch` in `NostrClient` to fetch missing root events and sparse histories in a single `pool.list` request. - Refactored `hydrateVideoHistory` to use shared helper methods `getLocalVideoHistory` and `_processAndCacheEvent`. - Added `resolveVideoPostedAtBatch` to `PlaybackCoordinator` which delegates to the batched client method. - Updated `VideoListView` to collect videos needing timestamp resolution and call the batch method, falling back to individual calls if necessary. - Added regression test `tests/performance/resolvePostedAt.test.mjs` to verify reduced network calls. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
7164475c5e
commit
b28e62963f
6 files changed
+380
-119
No files matched your search
@@ -950,6 +950,7 @@ export default class ApplicationBootstrap {
|
||||
buildShareUrlFromEventId: (eventId) => app.buildShareUrlFromEventId(eventId),
|
||||
getKnownVideoPostedAt: (video) => app.getKnownVideoPostedAt(video),
|
||||
resolveVideoPostedAt: (video) => app.resolveVideoPostedAt(video),
|
||||
batchResolveVideoPostedAt: (videos) => app.resolveVideoPostedAtBatch(videos),
|
||||
canManageBlacklist: () => app.canCurrentUserManageBlacklist(),
|
||||
canEditVideo: (video) => video?.pubkey === app.pubkey,
|
||||
canDeleteVideo: (video) => video?.pubkey === app.pubkey,
|
||||
|
||||
Reference in new issue
Block a user