fix: Prefix the job workflow names with job (#7908)
This commit is contained in:
@@ -5,7 +5,7 @@ export default async function handler(container: MedusaContainer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
name: "summarize-orders-job",
|
name: "summarize-orders",
|
||||||
schedule: "* * * * * *",
|
schedule: "* * * * * *",
|
||||||
numberOfExecutions: 2,
|
numberOfExecutions: 2,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ describe("register jobs", () => {
|
|||||||
await registerJobs([
|
await registerJobs([
|
||||||
{ resolve: path.join(__dirname, "../__fixtures__/plugin") },
|
{ resolve: path.join(__dirname, "../__fixtures__/plugin") },
|
||||||
])
|
])
|
||||||
const workflow = WorkflowManager.getWorkflow("summarize-orders-job")
|
const workflow = WorkflowManager.getWorkflow("job-summarize-orders")
|
||||||
expect(workflow).toBeDefined()
|
expect(workflow).toBeDefined()
|
||||||
expect(workflow?.options.schedule).toEqual({
|
expect(workflow?.options.schedule).toEqual({
|
||||||
cron: "* * * * * *",
|
cron: "* * * * * *",
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export const registerJobs = async (plugins) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createJob = async ({ config, handler }) => {
|
const createJob = async ({ config, handler }) => {
|
||||||
|
const workflowName = `job-${config.name}`
|
||||||
const step = createStep(
|
const step = createStep(
|
||||||
`${config.name}-as-step`,
|
`${config.name}-as-step`,
|
||||||
async (stepInput, stepContext) => {
|
async (stepInput, stepContext) => {
|
||||||
@@ -56,7 +57,7 @@ const createJob = async ({ config, handler }) => {
|
|||||||
|
|
||||||
createWorkflow(
|
createWorkflow(
|
||||||
{
|
{
|
||||||
name: config.name,
|
name: workflowName,
|
||||||
schedule: {
|
schedule: {
|
||||||
cron: config.schedule,
|
cron: config.schedule,
|
||||||
numberOfExecutions: config.numberOfExecutions,
|
numberOfExecutions: config.numberOfExecutions,
|
||||||
|
|||||||
Reference in New Issue
Block a user