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

@fastify/schedule

Package Overview
Dependencies
Maintainers
17
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/schedule

Fastify plugin for scheduling periodic jobs

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.2K
decreased by-40.83%
Maintainers
17
Weekly downloads
 
Created
Source

fastify-schedule

CI NPM Version Known Vulnerabilities Coverage Status code style: prettier

Fastify plugin for scheduling periodic jobs. Provides an instance of toad-scheduler on fastify instance.
Jobs are stopped automatically when the fastify instance is stopped.

Getting started

First install the package:

npm i fastify-schedule toad-scheduler

Next, set up the plugin:

const { fastifySchedulePlugin } = require('fastify-schedule')
const fastify = require('fastify');

fastify.register(fastifySchedulePlugin);

From there jobs can be added to scheduler at any point until the application is stopped:

const { SimpleIntervalJob, AsyncTask } = require('toad-scheduler')

const task = new AsyncTask(
    'simple task',
    () => { return db.pollForSomeData().then((result) => { /* continue the promise chain */ }) },
    (err: Error) => { /* handle errors here */ }
)
const job = new SimpleIntervalJob({ seconds: 20, }, task)

fastify.scheduler.addSimpleIntervalJob(job)

For more detailed instructions, see the documentation of toad-scheduler.

Keywords

FAQs

Package last updated on 26 May 2022

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