Async import of the appStore packages#10
Conversation
| ); | ||
| try { | ||
| bookingRefsFiltered.forEach((bookingRef) => { | ||
| bookingRefsFiltered.forEach(async (bookingRef) => { |
There was a problem hiding this comment.
Async callbacks in Array.forEach() are not awaited, so these delete operations may run in the background and any rejection from await getCalendar won’t be caught by this try/catch. This can lead to unhandled rejections and incomplete cancellations.
🤖 Was this useful? React with 👍 or 👎
| ); | ||
| try { | ||
| bookingRefsFiltered.forEach((bookingRef) => { | ||
| bookingRefsFiltered.forEach(async (bookingRef) => { |
There was a problem hiding this comment.
Async callbacks in Array.forEach() are not awaited, so these delete operations may run in the background and any rejection from await getCalendar won’t be caught by this try/catch. This can lead to unhandled rejections and incomplete cancellations.
🤖 Was this useful? React with 👍 or 👎
| (ref) => !!credentialsMap.get(ref.type) | ||
| ); | ||
| bookingRefsFiltered.forEach((bookingRef) => { | ||
| bookingRefsFiltered.forEach(async (bookingRef) => { |
There was a problem hiding this comment.
Using an async callback with Array.forEach() means these cancel operations aren’t awaited; any failure from await getCalendar (or subsequent calls) can go unhandled and the routine may proceed before deletions complete. This risks inconsistent state in reschedules.
🤖 Was this useful? React with 👍 or 👎
| @@ -458,7 +458,7 @@ async function handler(req: CustomRequest) { | |||
| bookingToDelete.user.credentials | |||
| .filter((credential) => credential.type.endsWith("_calendar")) | |||
| .forEach(async (credential) => { | |||
There was a problem hiding this comment.
Async callbacks in forEach() are not awaited; pushing to apiDeletes inside this loop may race with any later Promise.all on that array, and errors from await getCalendar will bypass the surrounding try/catch. This can cause missed deletions and unhandled rejections.
🤖 Was this useful? React with 👍 or 👎
No description provided.