@app/jobs
A mechanism that allows you to declare and execute background tasks:
- After a certain interval (see scheduleJobAfter)
- As soon as possible (see scheduleJobAsap)
- At a specific time (see scheduleJobAt)
app.job('jobPath', callback)
Arguments
Parameter | Type | Description |
---|---|---|
jobPath | string | The path of the job |
callback | async function | The callback function that is called when the job is executed. |
Example of declaring a job
app.job('jobPath', async (ctx, req) => {
ctx.log('Job called', req)
})