Skip to content

[Bug] Calendar parsed prior to filtering - unable to load large ics file #4103

@Evarda

Description

@Evarda

Environment

Hi, long time user. Don't think you need my system info for this one, so I'm going to skip this. I updated recently and pulled the code below from the main version of the Git Repo.
I have an issue with a calendar I've used for many years, has many events. All my other calendars work fine, all of my new calendars work fine. I run this on a raspberry pi with decent specs but also run my homebridge on it. This calendar used to be the slowest to load - one day it just stopped loading and has not loaded since.
I noticed the calendar fetcher parses the entire ical and then filters the events.
Can we fix this to make the filter happen when the calendar is loaded rather than loading the information first then filtering it?
I am fairly certain my calendar not loading is related to this. I have also seen others report calendar not loading issues, and I wonder if this is the root cause (I'm not sure what limits the size of parsed).

This is in calendarfetcher.js, see how it loads the ics and then parses after:

try {

			const responseData = await response.text();
			const parsed = ical.parseICS(responseData);

			Log.debug(`Parsed iCal data from ${this.url} with ${Object.keys(parsed).length} entries.`);

			this.events = CalendarFetcherUtils.filterEvents(parsed, {
				excludedEvents: this.excludedEvents,
				includePastEvents: this.includePastEvents,
				maximumEntries: this.maximumEntries,
				maximumNumberOfDays: this.maximumNumberOfDays
			});

I feel like this is what is causing the problem.
Hopefully this is possible to do and wouldn't be problematic to implement!

Which start option are you using?

node --run server

Are you using PM2?

No

Module

None

Have you tried disabling other modules?

  • Yes
  • No

Have you searched if someone else has already reported the issue on the forum or in the issues?

  • Yes

What did you do?

Reproduce:
Have big old calendar file; try to load; have it never load.
Have many new calendar files; no problems loading

To be fair, I haven't checked the size of the big old calendar file, but I know it has a lot of events on it...

What did you expect to happen?

I expect calendar to load.

What actually happened?

Calendar events do not load. No error.

Additional comments

Sorry I'm not doing a great job filling out the fields with all my system information for this. If this is not the reason, I'm back to the drawing board on this issue... I'm hoping that pointing out the issue in data handling I believe is causing this issue will fix the bug I'm running into.

Also thank you!! :)

Participation

  • I am willing to submit a pull request for this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions