www/apps/resources/app/troubleshooting/_sections/scheduled-jobs/not-running.mdx
If you have a scheduled job that is configured with a cron expression, it may not run at the expected times sometimes.
When a scheduled job is configured with a cron expression, it will only run when the specified time is reached.
So, if the events system is busy and the specified time is missed, the job will not run until the next scheduled time.
If you prioritize running your scheduled jobs consistently over precise timing, consider using a scheduled job interval instead.
By using an interval, the job will run after a defined duration, regardless of the system's state.
For example, to run a scheduled job every minute, you can set the interval to 60000 milliseconds (1 minute):
import { MedusaContainer } from "@medusajs/framework/types"
export default async function greetingJob(container: MedusaContainer) {
const logger = container.resolve("logger")
logger.info("Greeting!")
}
export const config = {
name: "greeting-every-minute",
schedule: {
interval: 60000, // 1 minute
},
}