Skip to content

Start expansion near the window for open-ended series #37

Closed

Description

@PhilflowIO

Symptom

expandOccurrences always iterates from DTSTART. An open-ended series far from its start (a yearly birthday from 1960, a daily series from 2010) costs work proportional to its age, not to the window, before the first occurrence in the window is reached. With many such series the shared work budget runs out and consumers report "incomplete" although nothing is wrong. Seen in the review of PhilflowIO/dav-mcp#170: about 1,600 open-ended yearly series exhaust a 300,000-unit budget on every call.

Fix

  • expandOccurrences takes an optional lower bound (from). For a rule without COUNT, iteration starts at the last rule period at or before from that is aligned to DTSTART by FREQ and INTERVAL (year / month / week with WKST / day / hour / minute / second), computed on the series' wall clock, instead of at DTSTART. BY parts and BYSETPOS apply per period, so the result is unchanged.
  • With COUNT, the start cannot be skipped (the count needs every earlier instance); keep iterating from DTSTART, or document a cheaper exact route if one exists.
  • RDATE, EXDATE and overrides behave exactly as now.
  • Cost of an open-ended series becomes independent of its age.

Acceptance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions