Skip to content

perf(calendar): use async ICS parsing to avoid blocking event loop#4143

Merged
khassel merged 1 commit intoMagicMirrorOrg:developfrom
KristjanESPERANTO:calendar-async
May 6, 2026
Merged

perf(calendar): use async ICS parsing to avoid blocking event loop#4143
khassel merged 1 commit intoMagicMirrorOrg:developfrom
KristjanESPERANTO:calendar-async

Conversation

@KristjanESPERANTO
Copy link
Copy Markdown
Collaborator

This switches the calendar fetcher from synchronous to asynchronous ICS parsing.

It does not necessarily make parsing faster overall, but it avoids long event-loop stalls with large calendar files (especially on slower devices and with multiple feeds).

So this does not fully solve #4103 on its own, but it clearly mitigates it.

It should also combine well with a future pre-filter approach discussed in the issue:

  • with pre-filter = less data to parse (future PR)
  • with async parsing = less blocking while parsing (this PR)

Together, that is likely the strongest path to fully address #4103.

Replace synchronous ical.parseICS() with ical.async.parseICS(), which
processes data in batches via setImmediate(). Prevents the Node.js event
loop from freezing on large calendars (1000+ events) on low-end hardware.

Ref MagicMirrorOrg#4103
@khassel khassel merged commit 7da9e5a into MagicMirrorOrg:develop May 6, 2026
12 checks passed
@KristjanESPERANTO KristjanESPERANTO deleted the calendar-async branch May 6, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants