Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • erp5 erp5
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Merge requests 141
    • Merge requests 141
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • 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
Time tracking
Source branch: fix/periodicity_impossible_combinations
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7