-
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): Cancel all jobs related to a transactionId from the 'cancel' method #4616
fix(api): Cancel all jobs related to a transactionId from the 'cancel' method #4616
Conversation
NV-3019 Cancel trigger api is not cancelling all events related to that transactionId
Checkout loom video below for steps to reproduce https://www.loom.com/share/11a83935b8714bbdbedb146040f4b058?sid=58dd374c-1a1a-42e1-91ce-f0377fcb5c75 |
@@ -24,13 +24,13 @@ describe('Trigger event - Delay triggered events - /v1/events/trigger (POST)', f | |||
let standardQueueService: StandardQueueService; | |||
const messageRepository = new MessageRepository(); | |||
|
|||
const triggerEvent = async (payload, transactionId?: string, overrides = {}) => { | |||
const triggerEvent = async (payload, transactionId?: string, overrides = {}, to = [subscriber.subscriberId]) => { |
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.
Added the ability to test more than 1 subscriber
@@ -342,7 +344,7 @@ describe('Trigger event - Delay triggered events - /v1/events/trigger (POST)', f | |||
content: '', | |||
metadata: { | |||
unit: DigestUnitEnum.SECONDS, | |||
amount: 0.1, | |||
amount: 5, |
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.
To avoid flakiness in the test
const jobs = await this.jobRepository.find( | ||
{ | ||
_environmentId: command.environmentId, | ||
transactionId: command.transactionId, | ||
status: JobStatusEnum.DELAYED, | ||
}, | ||
'_id' | ||
); |
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.
it will still find only the delay job - as its the only one that has DELAYED status. The others are pending. Or am I missing something?
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.
Never mind. Got you. its multiple subscribers
What change does this PR introduce?
Why was this change needed?
Closes NV-3019
Other information (Screenshots)