-
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
feat(api): Allow Events/Workflows to be processed/triggered with priority #6489
base: next
Are you sure you want to change the base?
Conversation
Unsure of what branch to make this against to have the highest probability of getting it merged. Are you doing anymore 0.2x releases before 2.0? |
Which version are you using? We are still doing hotfixes for v0.2x and we plan to have the first v2.0 docker release in October. |
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.
Thanks for the contribution. Please take a look at the comment and as soon as it's resolved we will be happy to merge this.
apps/api/src/app/events/usecases/parse-event-request/parse-event-request.usecase.ts
Outdated
Show resolved
Hide resolved
I'm currently using 0.23. Are you hotfixing existing builds so a new image pull would include hotfixes? Would be super ideal if this could come into 0.23 as we had issues going to 0.24 back in late march but didn't spend much time debugging or trying to figure out what it was because 0.23 had what we needed. We would plan to evaluate and move to 2.x when that comes out? How would this PR end up in that release? Will you guys move it in or should I do a similar PR against next? |
I will merge this PR into Can you please open the same one using the v0.24.x branch as a base? |
This was based against 0.24 originally. But if the changes are easy to rebase to next then yes I'll open it up again based from 0.24. What branch should the PR be against? |
There is a |
Sounds good. Thanks! |
68d6d3f
to
5d9c210
Compare
To resolve conflicts I just re-created the PR based from next in a separate branch and force pushed that to this branch.
Here is that PR: #6528 |
apps/api/src/app/events/usecases/parse-event-request/parse-event-request.command.ts
Show resolved
Hide resolved
Great job on the priority addon super clean solution! if the platform is not fully scalable. triggering a large number of notifications at once could lead to latency. I have two quick questions about this pull request:
|
There is one other PR referenced further up but it's the exact same change just against the 0.2x branch. No other PR with any more features. The parseEventRequest is taking the payload from the API endpoint. An example for how passing priority would look like this: import { Novu } from "@novu/node";
const novu = new Novu("<NOVU_SECRET_KEY>");
await novu.trigger("<WORKFLOW_TRIGGER_IDENTIFIER>", {
to: {
subscriberId: "<UNIQUE_SUBSCRIBER_IDENTIFIER>",
email: "[email protected]",
firstName: "John",
lastName: "Doe",
},
priority: 2,
payload: {
name: "Hello World",
organization: {
logo: "https://happycorp.com/logo.png",
},
},
}); This give all the control to the developer who explicitly decides whether or not to make use of priority. Events triggered without setting a priority would be processed before any events that have a priority as per how bull works.
@SokratisVidros left these comments further up in a review comment.
I suggest adding a if (process.env.IS_DOCKER_HOSTED === 'true') { check before passing the priority option. |
@rifont is this still waiting on you? seems like this has gone stale since I made the changes you requested. |
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.
We will approve and release this with the caveat as listed here: #6528 (review)
} from '@novu/shared'; | ||
|
||
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command'; | ||
import { ApiHideProperty } from '@nestjs/swagger'; |
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.
Needed to resolve the import order linting problem here.
} from '@novu/shared'; | |
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command'; | |
import { ApiHideProperty } from '@nestjs/swagger'; | |
} from '@novu/shared'; | |
import { ApiHideProperty } from '@nestjs/swagger'; | |
import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command'; |
What changed? Why was the change needed?
Allows workflow trigger to specify a priority with a value that's then passed onto BullMQ and determines the priority processing of the items on the queue.
https://discord.com/channels/895029566685462578/1282721751922638858