-
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(api-service): Fix api e2e deadlock #7575
Conversation
✅ 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. |
c3ad7dc
to
0f6370d
Compare
0f6370d
to
6149dd8
Compare
51c682b
to
97458bb
Compare
@@ -446,7 +446,7 @@ describe('Topic Trigger Event #novu-v2', () => { | |||
content: '', | |||
metadata: { | |||
unit: DigestUnitEnum.SECONDS, | |||
amount: 5, | |||
amount: 1, |
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.
is this enough to digest?
}); | ||
} while (totalCount > 0 || runningJobs > unfinishedJobs); | ||
// Wait until there are no pending, queued or running jobs in Mongo | ||
runningJobs = Math.max( |
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.
why we need to do max?
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.
So that if any of us pass a -1 to change it.
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 not sure if I get it, here we have the result of this.jobRepository.count
}, | ||
}; | ||
public async runAllDelayedJobsImmediately() { | ||
const delayedJobs = await this.standardQueue.getDelayed(); |
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 thought we used this more nested in the logic, but now i see that it was used only once in the tests.
i am not sure that i like this name because it is misleading, what it will do is run the current queued delay job immediately
and not run all..
for example, if you will have workflow: in-app-1 -> delay-1 -> in-app-2 -> delay-2 -> in-app-3
and you run
await session.waitForJobCompletion(template?._id);
await session.runAllDelayedJobsImmediately();
you could still have jobs in-app-2, delay-2, in-app-3 pending in the pipeline.
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.
Good call out. I will update the name.
c21edb0
to
c411dc8
Compare
Fail faster in case a deadlock occurs in API e2e tests
Prevent deadlocks while waiting for the worker to process async jobs during e2e tests.
So that it runs in less than 5seconds that is the mocha timeout
dd415ce
to
b2e0c5f
Compare
What changed? Why was the change needed?
Screenshots
Expand for optional sections
Related enterprise PR
Special notes for your reviewer