-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix(worker): delay duration #7496
base: next
Are you sure you want to change the base?
fix(worker): delay duration #7496
Conversation
…duration-limits-for-digest-and-delay-steps-in-code-first
✅ Deploy Preview for dev-web-novu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for dashboard-v2-novu-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…duration-limits-for-digest-and-delay-steps-in-code-first
…est-and-delay-steps-in-code-first
…duration-limits-for-digest-and-delay-steps-in-code-first
* If queueNextJob.execute returns undefined, we stop the workflow. | ||
* Otherwise, we continue trying to queue the next job in the chain. | ||
*/ | ||
private async tryQueueNextJobs(job: JobEntity): Promise<void> { |
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 needed because not we have a possible exception on finally block which is not handled.
for the following workflow SMS => DELAY => IN-APP
the problem is the we handle the delay step (calculate the duration) while we executing the SMS job.
a better solution would be to handle the DELAY step while we execute the DELAY job.
a refactor will take a lot of time and we will need to create backward compatibility support for old jobs as well.
const cronExpression = parseCronExpression(command.cron); | ||
const firstTime = cronExpression.next().toDate(); | ||
const secondTime = cronExpression.next().toDate(); | ||
private isCronDeltaDeferDurationExceededTier( |
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 tried to create a simple "smart solution" however on every approach it became very complicated very fast, therefore I created a more simple solution where we validate the next 50 iterations of the crown with an exit if we pass 2 years.
@@ -142,6 +166,10 @@ const isCronExpression = (cron: string) => { | |||
}; | |||
|
|||
const isRegularDeferAction = (command: TierRestrictionsValidateCommand) => { | |||
if (command.deferDurationMs) { |
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.
a bug we had, where we did not check the deferDurationMs that the worker was passing.
…est-and-delay-steps-in-code-first
What changed? Why was the change needed?
Screenshots
Expand for optional sections
Related enterprise PR
Special notes for your reviewer