Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 136
    • Merge requests 136
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !1551

Merged
Created Feb 09, 2022 by Jérome Perrin@jeromeOwner

periodicity: fix infinite loop with impossible combinations of week and months

  • Overview 2
  • Commits 1
  • Pipelines 1
  • Changes 4

Some combinations of periodicity, for example repeat every first week of the year and every month February are impossible (because the first week of the year is always in January) and such configurations caused infinite loops or probably overflow if we wait long enough.

The algorithm being to try the next day until all constraints are met, it is not guaranteed to terminate.

To make sure the algorithm terminate, we rely on the fact that calendars repeat after some time, so if after a few years we did not find a matching combination, we can stop retrying.

according to https://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week

Each leap year repeats once every 28 years, and every common year repeats once every 6 years and twice every 11 years.

so trying for 28 years should be enough to see all combinations

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: fix/periodicity_impossible_combinations
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7