Merge pull request #2351 from PR0M3TH3AN/perf-resolve-timestamp-parallel-12548316095717606632

⚡ Parallelize timestamp resolution in feed engine
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-02-11 07:45:10 -05:00
commit 9fc845cd1a
1 file changed
+13 -5
+13 -5
View File
@@ -173,9 +173,9 @@ async function resolveTimestampWithResolvers({
return null;
}
for (const resolver of resolvers) {
const promises = resolvers.map(async (resolver) => {
if (typeof resolver !== "function") {
continue;
throw new Error("Resolver is not a function");
}
try {
@@ -183,12 +183,20 @@ async function resolveTimestampWithResolvers({
if (Number.isFinite(value)) {
return Math.floor(value);
}
throw new Error("Invalid timestamp value");
} catch (error) {
context?.log?.(`[${stageName}] resolve timestamp hook threw`, error);
if (error.message !== "Invalid timestamp value") {
context?.log?.(`[${stageName}] resolve timestamp hook threw`, error);
}
throw error;
}
}
});
return null;
try {
return await Promise.any(promises);
} catch (error) {
return null;
}
}
export function createResolvePostedAtStage({