Skip to content

increase max empty sets to allow less-frequent rules #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2018

Conversation

kielni
Copy link
Contributor

@kielni kielni commented Aug 23, 2018

this rule throws an java.lang.IllegalArgumentException:

FREQ=MINUTELY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=21;BYMINUTE=0, 15;

iterating one minute at a time, 21:00 is 1,260 minutes after 00:00
but FreqIterator gives up and throws an exception after 1,000 iterations

update MAX_EMPTY_SETS and MAX_FILTERED_INSTANCES to allow for up to three days in minutes (4,230 minutes) before giving up

this rule throws an `java.lang.IllegalArgumentException`:

    FREQ=MINUTELY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=21;BYMINUTE=0, 15;

iterating one minute at a time, 21:00 is 1,260 minutes after 00:00
but FreqIterator gives up and throws an exception after 1,000 iterations

update MAX_EMPTY_SETS and MAX_FILTERED_INSTANCES to allow for up to three days in minutes (4,230 minutes) before giving up
@dmfs
Copy link
Owner

dmfs commented Aug 25, 2018

I'm curious, is this a rule which has an actual application? I mean it's completely equivalent to these:

FREQ=HOURLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=21;BYMINUTE=0,15
FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=21;BYMINUTE=0,15
FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=21;BYMINUTE=0,15
FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=21;BYMINUTE=0,15
FREQ=YEARLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=21;BYMINUTE=0,15

Except that all of these would be much more efficient in expansion because they generate fewer intermediate results that are filtered out anyway.

I don't mind increasing the limits, but why which one is best? Why not increase right to 5000, 10,000 or even 100,000?

@kielni
Copy link
Contributor Author

kielni commented Aug 27, 2018

You're right that one of those is equivalent. I rewrote the rule above successfully, but ran into the same exception with this rule:

FREQ=MINUTELY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=12,13,14,15,16,17;INTERVAL=15;

What do you think about making the limit configurable? I chose 3 days because I have a bunch of rules that don't apply on the weekends, but obviously I don't know how others are using it.

@dmfs
Copy link
Owner

dmfs commented Aug 29, 2018

Right. I'm planning to rewrite large parts of the recurrence iterator (in fact I already started). As part of this it should be possible to leave it to the caller to decide if and how empty recurrence intervals should be limited.
The idea is to let empty recurrence intervals bubble up to the highest level instead of dropping them right away like in the current solution. This will decrease performance for rules which generate many empty intervals. For most rules, however, empty intervals are an edge case, so I wouldn't expect a major performance hit.
For now I'm going to merge this PR.

@dmfs dmfs merged commit 3944001 into dmfs:master Aug 29, 2018
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