TheDocumentation 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.
Scheduler class is the main entry point for scheduling tasks in your AdonisJS application. It provides methods to register commands and callbacks to run on a schedule.
Constructor
The AdonisJS application service instance
Properties
Day Constants
The Scheduler class provides constants for days of the week:SUNDAY = 0MONDAY = 1TUESDAY = 2WEDNESDAY = 3THURSDAY = 4FRIDAY = 5SATURDAY = 6
Methods
command()
Schedule a command to run on a cron schedule.The command name as a string (e.g.,
'mail:send') or the command class referenceOptional arguments to pass to the command. Can be a single string or an array of strings
Returns a ScheduleCommand instance that can be chained with frequency and configuration methods
call()
Schedule a callback function to run on a cron schedule.The callback function to execute. Can be synchronous or asynchronous
Returns a ScheduleCallback instance that can be chained with frequency and configuration methods
withoutOverlapping()
Apply thewithoutOverlapping configuration to all tasks defined within the callback.
A callback function where you define tasks. All tasks defined within this callback will have
withoutOverlapping enabledConfiguration object with
expiresAt property (in milliseconds) that determines when the lock expireswithTag()
Apply a tag to all tasks defined within the callback.A callback function where you define tasks. All tasks defined within this callback will have the specified tag
The tag name to apply to all tasks within the callback
onStarting()
Register a callback that will be executed before the scheduler starts processing tasks for a specific tag.A callback function that receives an object with the tag name. Can be synchronous or asynchronous
onStarted()
Register a callback that will be executed after the scheduler has started processing tasks for a specific tag.A callback function that receives an object with the tag name. Can be synchronous or asynchronous
onBoot()
Register a callback that will be executed when the scheduler is booting, before loading decorator-based schedules.A callback function to execute during boot. Can be synchronous or asynchronous
boot()
Initializes the scheduler by loading all commands and decorator-based schedules. This method is called automatically by the Worker.- Calls the
onBootcallback if registered - Loads commands from the application’s commands path
- Loads commands defined in
.adonisrc.json - Registers all decorator-based schedules