Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
process-custodian
Advanced tools
This package helps with organizing of tasks between few instances of same app, It can identify processes and track them activity.
This package helps with organizing of tasks between few instances of same app, It can identify processes and track them activity.
npm install process-custodian --save
This package gives collision-resistant fingerprint for each process. Process fingerprint has 6 char length with structure: (hostname - pid - random). So, It is optimized for horizontal scaling and binary search lookup performance.
After create new instance of ProcessCustodian
, this package saves a heartbeat of process
to the passed raw mongodb collection with frequency about tickTimeInSeconds
(which default is 60s)
First of processes, which will be able to reserve self as a master, will be the master process to the moment of dead or lose master role if will be too busy to save in database a heartbeat at the time.
import ProcessCustodian from 'process-custodian';
import {MongoClient} from 'mongodb'
MongoClient.connect('mongodb://localhost:27017/test', function(err, db) {
// Create a collection we want to drop later
const collection = db.collection('process_custodian');
const handle = new ProcessCustodian({rawCollection: collection, tickTimeInSeconds: 60});
const stopOnTick = handle.onTick(() => {
console.log('tick', handle.isMaster() ? 'master': 'slave')
});
handle.onIAmNewMaster(() => {
console.log('I am master');
});
handle.onIAmSlave(() => {
console.log('I am slave');
});
const lag = handle.getEventLoopLag();
const stopSomething = handle.isOverloaded();
import ProcessCustodian from 'process-custodian';
// for meteor:
const collection = new Mongo.Collection('process_custodian');
const handle = new ProcessCustodian({
rawCollection: collection.rawCollection(),
tickTimeInSeconds: 60
marginTimeForRenew = 10
});
handle.onceTick(() => {
console.log('tick', handle.isMaster() ? 'master': 'slave')
});
handle.onIAmNewMaster(() => {
console.log('I am master');
});
handle.onIAmSlave(() => {
console.log('I am slave');
});
// if no necessery any more
handle.stop();
import {getFingerprint, humanize} from 'process-custodian';
//Getting fingerprint
console.log('id:', getFingerprint()); // e.g. output: id: ji4fmf
console.log('human:', humanize(getFingerprint())); // e.g. output: human: ji-4f-mf
FAQs
This package helps with organizing of tasks between few instances of same app, It can identify processes and track them activity.
The npm package process-custodian receives a total of 579 weekly downloads. As such, process-custodian popularity was classified as not popular.
We found that process-custodian demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.