-
Notifications
You must be signed in to change notification settings - Fork 4k
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): timed digest event merging #4979
fix(worker): timed digest event merging #4979
Conversation
|
||
const promiseTimeout = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms)); | ||
|
||
describe('Trigger event - Scheduled Digest Mode - /v1/events/trigger (POST)', function () { |
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 a new test suite for scheduled digest
@@ -215,7 +216,7 @@ export class JobRepository extends BaseRepository<JobDBModel, JobEntity, Enforce | |||
_subscriberId: this.convertStringToObjectId(job._subscriberId), | |||
...(digestKey && { [`payload.${digestKey}`]: digestValue }), | |||
}, | |||
'_id' | |||
'_id _notificationId' |
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 removed the digest filter steps, and in order to replace it's functionality of updating the notificationId after the active digest, we return it here to later update the entity.
libs/testing/src/jobs.service.ts
Outdated
} | ||
} | ||
}, | ||
runDelayedImmediatly: async () => { |
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 new testing functionality allows running immediatly delayed jobs on bull mq
$set: { | ||
status: JobStatusEnum.MERGED, | ||
_mergedDigestId: activeDigestId, | ||
await Promise.all([ |
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.
Refactored to use promise all to improve performance
public async execute( | ||
command: DigestFilterStepsCommand | ||
): Promise<NotificationStepEntity[]> { | ||
const action: DigestFilterStepsRegular | DigestFilterStepsTimed = |
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 code is not needed anymore, since we want to only make a single decision on digest merged or not in the digest add job phase. Instead of doing it multiple times.
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.
Looks good 👍
fab9752
to
882f781
Compare
* fix: timed digest event gathering * feat: remove un needed digest filtering steps * fix: spelling * fix: object id typing * fix: increase timeout * chore(api): remove mocha timeout on package.json scripts --------- Co-authored-by: Paweł <pawel.tymczuk@gmail.com>
* fix: timed digest event gathering * feat: remove un needed digest filtering steps * fix: spelling * fix: object id typing * fix: increase timeout * chore(api): remove mocha timeout on package.json scripts --------- Co-authored-by: Paweł <pawel.tymczuk@gmail.com>
hotfix: timed digest event merging (#4979)
What change does this PR introduce?
Why was this change needed?
NV-3288
Other information (Screenshots)