Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adonisjs-scheduler

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonisjs-scheduler

Task scheduler for AdonisJS

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
increased by16.48%
Maintainers
1
Weekly downloads
 
Created
Source

AdonisJS Scheduler

Task scheduler for AdonisJS v6

npm License: MIT Typescript

Scheduler code example

For AdonisJS v5 use 0.x branch

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

Keywords

FAQs

Package last updated on 17 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc