mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 00:51:20 +00:00
fix: use Promise.allSettled for calendar fetching
A transient error on one calendar (e.g. shared calendar with permission issues) no longer discards results from all other calendars. Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -98,7 +98,7 @@ export class CalendarSource implements FeedSource<CalendarFeedItem> {
|
|||||||
|
|
||||||
const { start, end } = computeTimeRange(context.time, this.lookAheadDays)
|
const { start, end } = computeTimeRange(context.time, this.lookAheadDays)
|
||||||
|
|
||||||
const results = await Promise.all(
|
const results = await Promise.allSettled(
|
||||||
calendars.map(async (calendar) => {
|
calendars.map(async (calendar) => {
|
||||||
const objects = await client.fetchCalendarObjects({
|
const objects = await client.fetchCalendarObjects({
|
||||||
calendar,
|
calendar,
|
||||||
@@ -115,7 +115,9 @@ export class CalendarSource implements FeedSource<CalendarFeedItem> {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const allEvents: CalendarEventData[] = []
|
const allEvents: CalendarEventData[] = []
|
||||||
for (const { objects, calendarName } of results) {
|
for (const result of results) {
|
||||||
|
if (result.status !== "fulfilled") continue
|
||||||
|
const { objects, calendarName } = result.value
|
||||||
for (const obj of objects) {
|
for (const obj of objects) {
|
||||||
if (typeof obj.data !== "string") continue
|
if (typeof obj.data !== "string") continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user