feat(events): Implement default priority-based event processing (#14476)

* feat(events): Set internal events default priority to lowest, default events to 100 and order placed to 10

* Create swift-months-rush.md

* improvements

* improvements

* improvements

* fix condition

* doc

* fix tests

* fix tests

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2026-01-12 16:05:42 +01:00
committed by GitHub
parent 43951ce60e
commit 7307a5e63f
7 changed files with 617 additions and 17 deletions

View File

@@ -5,6 +5,10 @@ import path from "path"
jest.setTimeout(100000)
function getJobCounts(queue) {
return queue.waiting + queue.delayed + (queue.prioritized || 0)
}
medusaIntegrationTestRunner({
medusaConfigFile: path.join(
__dirname,
@@ -42,8 +46,7 @@ medusaIntegrationTestRunner({
const queue = (eventBus as any).queue_
const jobCountsBefore = await queue.getJobCounts()
const totalJobsBefore =
jobCountsBefore.waiting + jobCountsBefore.delayed
const totalJobsBefore = getJobCounts(jobCountsBefore)
await eventBus.emit(
composeMessage(testEventName, {
@@ -55,9 +58,9 @@ medusaIntegrationTestRunner({
)
const jobCountsAfterWithSubscriber = await queue.getJobCounts()
const totalJobsAfterWithSubscriber =
jobCountsAfterWithSubscriber.waiting +
jobCountsAfterWithSubscriber.delayed
const totalJobsAfterWithSubscriber = getJobCounts(
jobCountsAfterWithSubscriber
)
expect(totalJobsAfterWithSubscriber).toBeGreaterThan(totalJobsBefore)