async.ts 320 B

12345678
  1. // Runs concurrently so one slow/stuck item (e.g. a wallpaper folder on an unresponsive mount)
  2. // can't stall the rest of the batch behind it.
  3. export async function forEachIgnoringErrors<T>(
  4. items: T[],
  5. fn: (item: T) => Promise<unknown>
  6. ): Promise<void> {
  7. await Promise.allSettled(items.map((item) => fn(item)))
  8. }