-
Notifications
You must be signed in to change notification settings - Fork 233
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
Introduce EvaluationOptions
for params like MaxIncrementCount
#747
Comments
Fully agree, see #641, this is is a "must". |
Sorry, missed #641. Close this one as duplicate? NRT would certainly be nice but activating it later would probably not be a breaking change. Would it? |
This one is more descriptive. I closed the old one.
Yes, introducing NRT means a breaking change. |
@axunonb Just to avoid double work: I started working on this. Will try to draft a PR later this week. |
Today we the param
MaxIncrementCount
is hard coded inRecurrencePatternEvaluator
. It limits the number of iterations that will be calculated by the class without returning any recurrence, before aborting the calculations.The implementation has two major shortcomings:
Ad 1)
It would be good to introduce something like
EvaluationOptions
that is passed toCalendar.GetOccurrences
et al. For now the class should hold only theMaxIncrementCount
param that should replace the hard-coded value. In the future it could be extended by additional params. The new param toGetOccurrences()
would default to null, in which case default values would apply. The default value is TBD, I would suggest to have no limit as the default.Ad 2)
If the limit is hit, calculation stops silently, which prevents users from detecting the case. The default behavior should be that a specific exception is raised, maybe something like
IcalEvaluationLimitExceededException
or alternatively some more genericIcalEvaluationException
holding a more detailed error code as a property. Basically the behavior (fail/stop silently) could also be configured viaEvaluationOptions
but that doesn't seem to be too helpful as users can easily catch the exception and implement ignore it at the call site if desired.In the future the
EvaluationOptions
could hold additional propertiesI think it would be good to introduce the
EvaluationOptions
still in v5 so we have an extension point that allows us adding more in the future, without breaking the API.The text was updated successfully, but these errors were encountered: