1.0.5 • Published 2 months ago

adonisjs-scheduler v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Getting Started

This package is available in the npm registry.

pnpm install adonisjs-scheduler

Next, configure the package by running the following command.

node ace configure adonisjs-scheduler

Running The Scheduler

node ace scheduler:run
# or
node ace scheduler:work

Defining Schedules

// start/scheduler.ts

import scheduler from 'adonisjs-scheduler/services/main'

import PurgeUsers from "../commands/purge_users";

scheduler.command("inspire").everyFiveSeconds();
scheduler.command(PurgeUsers, ["30 days"]).everyFiveSeconds().withoutOverlapping();

scheduler.withoutOverlapping(() => {
  scheduler.command("inspire").everySecond();
  scheduler.command(PurgeUsers, ["30 days"]).everyFiveSeconds();
}, { expiresAt: 30_000 });

scheduler.call(() => {
    console.log("Pruge DB!");
}).weekly();

Schedule Frequency Options

MethodDescription
.cron('* * * * *');Run the task on a custom cron schedule
.everyMinute();Run the task every minute
.everyTwoMinutes();Run the task every two minutes
.everyThreeMinutes();Run the task every three minutes
.everyFourMinutes();Run the task every four minutes
.everyFiveMinutes();Run the task every five minutes
.everyTenMinutes();Run the task every ten minutes
.everyFifteenMinutes();Run the task every fifteen minutes
.everyThirtyMinutes();Run the task every thirty minutes
.hourly();Run the task every hour
.everyTwoHours();Run the task every two hours
.everyThreeHours();Run the task every three hours
.everyFourHours();Run the task every four hours
.everyFiveHours();Run the task every five hours
.everySixHours();Run the task every six hours
.daily();Run the task every day at midnight
.weekly();Run the task every Sunday at 00:00
.monthly();Run the task on the first day of every month at 00:00
.quarterly();Run the task on the first day of every quarter at 00:00
.yearly();Run the task on the first day of every year at 00:00
.immediate();Run the task on startup
.withoutOverlapping();Run the task without overlapping
1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

2 months ago

0.1.1

2 months ago

0.1.3

2 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

4 months ago

1.0.0-beta.0

4 months ago

0.1.0

4 months ago

0.0.25

7 months ago

0.0.20

1 year ago

0.0.21

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago