Skip to Content
nyx logonyx guide

Execution Scheduler

See in:
DefaultScheduleExecutionSchedulerGitHub
ScheduleExecutionSchedulerGitHub
Reading time:2 min read

The DefaultScheduleExecutionScheduler is responsible for interpreting the schedule's interval (usually a cron string) and creating/managing the ScheduleJobAdapter that will trigger execution.

It relies on the ScheduleJobAdapter to interface with the actual timing mechanism (e.g. croner), and the adapter is the one that waits for the scheduled time and invokes the execution.

When to override

✅ Override if you want to...❌ Don't override if you want to...
Use a different timing library or job backend (e.g., not croner).Just adjust the job adapter itself. Create a custom ScheduleJobAdapter instead.
Support a different interval format or next-run strategy (e.g., RRULE-like scheduling).Change schedule execution logic (try/catch, retry, middleware behavior). That belongs to ScheduleExecutor.
Implement custom misfire/catch-up behavior for delayed or missed runs.Change schedule persistence. That belongs to ScheduleRepository.

Overriding

Creation

Create a custom scheduler extending DefaultScheduleExecutionScheduler.

import {  } from '@nyx-discord/djs';

class  extends  {
  // Override internal methods
}

Registration

Create it and set it to the ScheduleManager.

import {  } from '@nyx-discord/djs';

class  extends  {
  /** Your overrides */
}

.().(.());

The DefaultScheduleExecutionScheduler.create() method instantiates your custom scheduler, not the default one.

Edit on GitHub

Last updated on

On this page