You can define scheduled tasks in your AdonisJS application using the scheduler service. The scheduler allows you to schedule both Ace commands and custom callbacks to run at specified intervals.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kabbouchi/adonisjs-scheduler/llms.txt
Use this file to discover all available pages before exploring further.
Importing the scheduler
Import the scheduler service in yourstart/scheduler.ts file:
Scheduling commands
Use thescheduler.command() method to schedule Ace commands. You can schedule commands by their string name or by passing the command class directly.
Scheduling by command name
Scheduling by command class
When scheduling by command class, you can also pass arguments to the command:Scheduling callbacks
Use thescheduler.call() method to schedule custom callback functions:
Chaining frequency methods
Bothscheduler.command() and scheduler.call() return a schedule instance that you can chain with frequency methods to define when the task should run:
Before and after callbacks
You can register callbacks to run before and after your scheduled tasks:before() and after() methods accept asynchronous functions and will be awaited during execution.