-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
refactor(core): Centralize CronJob management #10033
Conversation
bf4ed2e
to
55bd8b4
Compare
55bd8b4
to
e387cec
Compare
packages/nodes-base/nodes/Schedule/test/GenericFunctions.test.ts
Outdated
Show resolved
Hide resolved
014ec37
to
7a49bd7
Compare
}); | ||
}); | ||
|
||
describe.only('recurrenceCheck', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivov any idea why this did not get caught by the linter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely we need to update the first path in this line to '**/test/**/*.ts'
. Or have nodes-base start using the pattern from other packages: **/__tests__/*.ts
4 flaky tests on run #5961 ↗︎
Details:
10-undo-redo.cy.ts • 1 flaky test
5-ndv.cy.ts • 2 flaky tests
24-ndv-paired-item.cy.ts • 1 flaky test
Review all test suite changes for PR #10033 ↗︎ |
✅ All Cypress E2E specs passed |
…hour" crons from all triggering at the same minute
} | ||
const fallbackToZero = addFallbackValue(nodeVersion >= 1.2, '0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was introduced to fix a behavior for schedule nodes version 1.2 and above.
For version 1.0 and 1.1 if you set triggerAtMinute
to an empty string it will run every minute, as opposed to every hour/day/week, etc.
This was fixed here: #9146
The fix added the version 1.2 and only applied to that and following versions. I'm assuming this was done so that it would not break users that rely on the buggy behavior.
With this refactor we apply the "fixed" behavior to all versions now. Which is technically a breaking change.
@Joffcom sorry for looping you in here out of the blue, but maybe you have some insight if we can assume that this will break some workflows in the wild or if we can just "fix" it for all versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@despairblue correct, changes that could be breaking are usually scoped under version, if it's not bugfix
we need to update packages/cli/BREAKING-CHANGES.md
in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna try to add the check back, and also add tests to prevent this from breaking in the future 🤞🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For version 1.0 and 1.1 if you set triggerAtMinute to an empty string it will run every minute, as opposed to every hour/day/week, etc.
When I try this on older versions of the node, the Cron expression that's generated is ' * * * *'
, which in an invalid expression.
@michael-radency do you recall why did we decide to support this old behavior?
IMO, this is bug, and shouldn't have been supported. All versions of this node should fallback to 0
when the field is an empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the new code now if a user leaves the minute empty, we generate a valid cron expression by falling back to a random minute during activation.
I'm still not sure why we created a new version in #9146.
I believe this was a bug, and we should have fixed this in the existing version of the node.
If user is adding invalid values in any of the fields, then we don't owe them backward compatibility, nor do we need to document this as a breaking change.
IMO the changes proposed in this PR are backward compatible for anyone using this node as intended, for everyone else when the minute
field is left invalid, falling back to selecting a random minute during activation works fine.
|
✅ All Cypress E2E specs passed |
Got released with |
Summary
Letting individual nodes manage CronJob
This PR aims to centralize how we register cronJobs, to have a better control over their lifecycle.
Review / Merge checklist