Skip to content

Commit

Permalink
Allow downloading more content from a webpage and index it hoarder-ap…
Browse files Browse the repository at this point in the history
…p#215

fixed additional async/await issues
  • Loading branch information
kamtschatka committed Jul 21, 2024
1 parent 1a5f1bd commit c4d7fb6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/trpc/routers/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ export const tagsAppRouter = router({
if (res.changes == 0) {
throw new TRPCError({ code: "NOT_FOUND" });
}
affectedBookmarks.forEach(({ bookmarkId }) =>
triggerSearchReindex(bookmarkId),
await Promise.all(
affectedBookmarks.map(({ bookmarkId }) =>
triggerSearchReindex(bookmarkId),
),
);
}),
deleteUnused: authedProcedure
Expand Down Expand Up @@ -185,11 +187,11 @@ export const tagsAppRouter = router({
},
},
);
await Promise.all([
await Promise.all(
affectedBookmarks
.map((b) => b.bookmarkId)
.map((id) => triggerSearchReindex(id)),
]);
);
} catch (e) {
// Best Effort attempt to reindex affected bookmarks
console.error("Failed to reindex affected bookmarks", e);
Expand Down Expand Up @@ -304,9 +306,9 @@ export const tagsAppRouter = router({
);

try {
await Promise.all([
await Promise.all(
affectedBookmarks.map((id) => triggerSearchReindex(id)),
]);
);
} catch (e) {
// Best Effort attempt to reindex affected bookmarks
console.error("Failed to reindex affected bookmarks", e);
Expand Down

0 comments on commit c4d7fb6

Please sign in to comment.