Optimize subscription author lookup

This commit is contained in:
thePR0M3TH3AN committed 2025-10-18 21:46:27 -04:00
1 parent 090201e599
commit bf908c3b05
3 files changed
+159 -5

No files matched your search

+14 -3
View File
@@ -100,11 +100,22 @@ export function createSubscriptionAuthorsSource({ service } = {}) {
: () => false,
};
const authorList = Array.from(authors);
const hasTargetedLookup =
resolvedService &&
typeof resolvedService.getActiveVideosByAuthors === "function";
let videos = [];
try {
videos = await Promise.resolve(
resolvedService.getFilteredActiveVideos(options)
);
if (hasTargetedLookup) {
videos = await Promise.resolve(
resolvedService.getActiveVideosByAuthors(authorList, options)
);
} else {
videos = await Promise.resolve(
resolvedService.getFilteredActiveVideos(options)
);
}
} catch (error) {
context?.log?.(
"[subscriptions-source] Failed to resolve videos from nostrService",