Installations
npm install cron-cluster
Releases
Unable to fetch releases
Developer
iGLOO-be
Developer Guide
Module System
CommonJS
Min. Node Version
>=4
Typescript Support
No
Node Version
10.11.0
NPM Version
6.4.1
Statistics
40 Stars
21 Commits
11 Forks
5 Watching
1 Branches
5 Contributors
Updated on 14 Jun 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
1,656,990
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Cron-cluster
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.
Requirement
Redis
Install
1npm install cron-cluster
Usage
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.
Example
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
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 4 are checked with a SAST tool
Reason
46 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-6chw-6frg-f759
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9
- Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h
- Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6
- Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-2m96-9w4j-wgv7
- Warn: Project is vulnerable to: GHSA-h726-x36v-rx45
- Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-8hfj-j24r-96c4
- Warn: Project is vulnerable to: GHSA-wc69-rhjr-hc9g
- Warn: Project is vulnerable to: GHSA-56x4-j7p9-fcf9
- Warn: Project is vulnerable to: GHSA-v78c-4p63-2j6c
- Warn: Project is vulnerable to: GHSA-pc58-wgmc-hfjr
- Warn: Project is vulnerable to: GHSA-vvv8-xw5f-3f88
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
- Warn: Project is vulnerable to: GHSA-38h8-x697-gh8q
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
Score
1.4
/10
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