parse-server-jobs-scheduler
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Parse server jobs scheduler

Note

It's better to use cron job instead of using this library. You have to handle the concurrency issue since this plugin is running by parse server's workers if cluster is true.

How to use it?

Install the library

$ npm install parse-server-jobs-scheduler --save

Add those lines your Parse Cloud code main file

const Scheduler = require('parse-server-jobs-scheduler').default;
const scheduler = new Scheduler();
 
// Recreates all crons when the server is launched
scheduler.recreateScheduleForAllJobs();
 
// Recreates schedule when a job schedule has changed
Parse.Cloud.afterSave('_JobSchedule', async (request) => {
  scheduler.recreateSchedule(request.object.id)
});
 
// Destroy schedule for removed job
Parse.Cloud.afterDelete('_JobSchedule', async (request) => {
  scheduler.destroySchedule(request.object.id)
});

Readme

Keywords

none

Package Sidebar

Install

npm i parse-server-jobs-scheduler

Weekly Downloads

26

Version

1.1.1

License

ISC

Unpacked Size

12.2 kB

Total Files

11

Last publish

Collaborators

  • lcpmarvel