feat(medusa): Extract cron job logic to its own service (#2821)

**What**
Extract cron job logic from the `EventBusService` to its own service `JobSchedulerService`

**Why**
Preliminary step to extracting the event bus into a module

**Tests**
Tested with a local installation of Medusa

Resolved CORE-918
This commit is contained in:
Oliver Windall Juhl authored and GitHub committed 2022-12-19 19:04:46 +00:00
1 parent c8724da503
commit ba6bb3e54b
9 files changed
+385 -205

No files matched your search

@@ -3,10 +3,10 @@ const inventorySync = async (container, options) => {
return
} else {
const brightpearlService = container.resolve("brightpearlService")
const eventBus = container.resolve("eventBusService")
const jobSchedulerService = container.resolve("jobSchedulerService")
try {
const pattern = options.inventory_sync_cron
eventBus.createCronJob("inventory-sync", {}, pattern, () =>
jobSchedulerService.create("inventory-sync", {}, pattern, () =>
brightpearlService.syncInventory()
)
} catch (err) {