docs: update scheduled jobs docs (#7905)

- Update scheduled jobs docs to support updated definition + remove coming soon notice
- Update scheduled jobs everywhere else they're used.
This commit is contained in:
Shahed Nasser
2024-07-02 09:41:15 +00:00
committed by GitHub
parent 6cb28eedf7
commit 0aeba83a66
7 changed files with 104 additions and 74 deletions
+7 -10
View File
@@ -156,16 +156,13 @@ To execute the workflow, invoke it passing the Medusa container as a parameter.
</CodeTab>
<CodeTab label="Scheduled Job" value="scheduled-job">
```ts title="src/jobs/message-daily.ts" highlights={[["10"], ["11"], ["12"], ["13"], ["14"], ["15"]]}
import {
type ScheduledJobConfig,
type ScheduledJobArgs,
} from "@medusajs/medusa"
```ts title="src/jobs/message-daily.ts" highlights={[["7"], ["8"], ["9"], ["10"], ["11"], ["12"]]}
import { MedusaContainer } from "@medusajs/types"
import myWorkflow from "../workflows/hello-world"
export default async function handler({
container,
}: ScheduledJobArgs) {
export default async function myCustomJob(
container: MedusaContainer
) {
const { result } = await myWorkflow(container)
.run({
input: {
@@ -176,10 +173,10 @@ To execute the workflow, invoke it passing the Medusa container as a parameter.
console.log(result.message)
}
export const config: ScheduledJobConfig = {
export const config = {
name: "run-once-a-day",
schedule: `0 0 * * *`,
}
};
```
</CodeTab>