Skip to content

Count the search limit per occurrence, not per query - #2

Merged
janedbal merged 1 commit into
masterfrom
jn-search-limit-per-occurrence
Nov 16, 2026
Merged

janedbal merged 1 commit into
masterfrom
jn-search-limit-per-occurrence

Conversation

@janedbal

@janedbal janedbal commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Problem

The search budget counts every period of a query and is never reset. A plain iteration of a dense rule fails:

  • foreach over FREQ=MINUTELY throws SearchLimitExceededException after 1 000 000 occurrences (about 694 days).
  • between() over two years of the same rule throws.
  • withSearchLimit(10)->take(20) throws "examined 10 periods without reaching an answer" after it found 10 answers.

Change

  • RecurrenceEngine resets the budget when the query produces an occurrence. The limit now bounds the search for one occurrence.
  • An excluded candidate is not an occurrence. A set that an EXRULE removes fully still reaches the limit.
  • The README states the new meaning of the limit.

The search budget counted every period of a query and was never reset.
A plain iteration of a dense rule (FREQ=MINUTELY) threw
SearchLimitExceededException after 1 000 000 occurrences.

The engine now resets the budget when the query produces an occurrence.
The limit bounds the search for one occurrence. An excluded candidate
is not an occurrence, so a fully excluded set still reaches the limit.
@janedbal
janedbal merged commit ceb5d30 into master Nov 16, 2026
15 checks passed
@janedbal
janedbal deleted the jn-search-limit-per-occurrence branch November 16, 2026 08:21
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.

1 participant