-
Notifications
You must be signed in to change notification settings - Fork 19
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
Allow RRuleIter
state to be saved
#42
Comments
Interesting idea. I guess you can store the last date generated and when you want to resume, just use It might be quite tricky to store the state at a particular iteration as there are many moving parts, but definitely doable. Do you have a specific use case in mind for this feature? Something you need in your own application? I would like to understand the need for the feature better :) |
This is not what I mean with the initial post, but this is how I'm going to do it for now.
Yes I want to use this in our application.
Let me explain the use-case in a bit more detail. Now the solution to this I'm proposing is that we save the last created day found in the iteration, update the string The time interval (daily checks) is long enough that I don't just want to keep the RRule in memory until the next day. Also keeping things in memory does not scale well. The library is fast enough and everything is not time critical enough that this is a major requirement in our case. But I see this can also be useful in other situations.
Yes, there are definitely things that might throw this technique off. But this is the reason I'm asking it here. If you or other people can see the faults in my assumptions. Are there things I'm forgetting or mistaken by? Hope this makes it clearer. |
I was thinking about a way to we can have a
RRuleIter
and make it iterate over the different dates, but at some point save it so we can later resume iterations where we left of.This is a tricky problem as just changing the start date (
DTSTART
) does not work. Because it might result in different result dates.But this can however be done if the start date is equal to a date in the generated dates.
Lets say you have:
DTSTART:20210101T090000\nRRULE:FREQ=DAILY
This will generate dates like (generate 4 dates):
We can then save the iterator by changing it to
DTSTART:20210104T090000\nRRULE:FREQ=DAILY
If we then 'continue' the iterator (but this is a entirely new
RRuleIter
created from the string) to get more dates.I think this can work in all cases. There are however a few more things we would have to change to.
COUNT
) should also decremented.I'm curious if there are things I'm not thinking of.
This also requires a way of turning
RRuleProperties
back into a String. But this would be a nice feature anyway for stripping a rrule string from redundant data and making sure it is always valid.Let me know what you all think.
The text was updated successfully, but these errors were encountered: