Skip to content
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

Merged
merged 12 commits into from
Feb 6, 2025
Merged

Conversation

SokratisVidros
Copy link
Contributor

What changed? Why was the change needed?

Screenshots

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

Copy link

netlify bot commented Jan 23, 2025

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit b2e0c5f
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/67a492332e967200085d800f
😎 Deploy Preview https://deploy-preview-7575.dashboard.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 23, 2025

Deploy Preview for dashboard-v2-novu-staging ready!

Name Link
🔨 Latest commit b2e0c5f
🔍 Latest deploy log https://app.netlify.com/sites/dashboard-v2-novu-staging/deploys/67a49233699c0d00081a371f
😎 Deploy Preview https://deploy-preview-7575.dashboard-v2.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@SokratisVidros SokratisVidros changed the title Fix api e2e deadlock fix(api): Fix api e2e deadlock Jan 29, 2025
@SokratisVidros SokratisVidros changed the title fix(api): Fix api e2e deadlock fix(api-service): Fix api e2e deadlock Jan 29, 2025
@@ -446,7 +446,7 @@ describe('Topic Trigger Event #novu-v2', () => {
content: '',
metadata: {
unit: DigestUnitEnum.SECONDS,
amount: 5,
amount: 1,
Copy link
Contributor

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(
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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();
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@SokratisVidros SokratisVidros merged commit 79739cb into next Feb 6, 2025
32 of 37 checks passed
@SokratisVidros SokratisVidros deleted the fix_api_e2e_deadlock branch February 6, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants