Merge pull request #2720 from PR0M3TH3AN/perf-watch-history-parallel-18111087127374532903

⚡ Optimize watch history publishing with Promise.all
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-02-26 14:41:05 -05:00
commit d050156d69
1 file changed
+3 -5
+3 -5
View File
@@ -1234,17 +1234,15 @@ class WatchHistoryManager {
const months = Object.keys(records).sort();
const results = await pMap(
months,
async (month) => {
const results = await Promise.all(
months.map(async (month) => {
const items = records[month];
// Ideally we check if this month changed before publishing.
// For now, we rely on the caller or just publish.
// In a real optimized system we'd track dirty flags per month.
return this.publishMonthRecord(month, items, options);
},
{ concurrency: 5 },
}),
);
for (const res of results) {