Gathering detailed insights and metrics for cron-cluster
Gathering detailed insights and metrics for cron-cluster
Gathering detailed insights and metrics for cron-cluster
Gathering detailed insights and metrics for cron-cluster
npm install cron-cluster
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
40 Stars
21 Commits
11 Forks
5 Watching
1 Branches
5 Contributors
Updated on 14 Jun 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-6.6%
539
Compared to previous day
Last week
-0.6%
2,832
Compared to previous week
Last month
-12.1%
12,069
Compared to previous month
Last year
349.2%
800,724
Compared to previous year
Cron cluster is designed to prevent a job which must be launched only once to be launched many times while an app is scaling accross a cluster with the same task scripts.
Cron cluster is based on node-cron and redis-leader to prevent a cron job to be launched if his process has not been elected as leader on redis.
Redis
1npm install cron-cluster
Cron cluster use the same API as the original CronJob.
1var redis = require('redis').createClient() 2var CronJob = require('cron-cluster')(redis).CronJob 3 4function doCron () { 5 var job = new CronJob('* * * * * *', function () { 6 // Do some stuff here 7 }) 8 job.start() 9}
It is possible to initialize CronJob with an object passed as parameter and run the job only once for all the instances. Cron-cluster is compatible with original cron. More in test/cron-cluster-compatibility-check.js
1var redis = require('redis').createClient() 2var CronJob = require('cron-cluster')(redis).CronJob 3 4function doCron () { 5 var job = new CronJob({ 6 cronTime: '* * * * * *', 7 onTick: function () { 8 // Do some stuff here 9 } 10 }) 11 job.start() 12}
All you need is to provide a redis client to the cron-cluster module.
Usage with Kue:
1var kue = require('kue'), 2 queue = kue.createQueue() 3var redis = require('redis').createClient() 4var CronJob = require('cron-cluster')(redis).CronJob 5 6new CronJob('* * * * * *', function () { 7 queue.create('log', { 8 text: 'this is a log' 9 }).save() 10}, null, true) 11 12queue.process('log', function (job, done) { 13 console.log(job.data.text) 14 done() 15})
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 2/19 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
46 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More