
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
redlock-leader
Advanced tools
Leader election by Redlock Distributed Lock Manager algorithm.
npm install redlock-leader
const RedlockLeader = require('redlock-leader');
const client = require('redis').createClient({
host: process.env.REDIS_HOST || '127.0.0.1',
port: 6379,
enable_offline_queue: false,
//password: '',
//db: 1,
retry_strategy: function (options) {
return Math.min(options.attempt * 100, 3000);
}
});
const leader = new RedlockLeader({
clients: [client], {
ttl: 10000,
wait: 1000,
key: 'my-leader-key'
}});
leader.on('elected', () => console.log(`${process.pid} ${new Date()} Instance is elected as leader.`));
leader.on('revoked', () => console.log(`${process.pid} ${new Date()} Instance is no longer the leader.`));
leader.on('extended', () => console.log(`${process.pid} ${new Date()} Leadership status of instance is extended.
`));
leader.on('error', (e) => console.log(`${process.pid} ${new Date()} ERROR`, e));
leader.start();
Create a new leader selector.
clients An array of redis client instances.options An object holding the leader selection options.
ttl Lock time to live in milliseconds, defaults to 10000 milliseconds.wait Time between 2 tries getting elected in milliseconds, defaults to 1000 millisecondskey A string key identifying the lock, defaults to 'redlock-leader'Starts leader selection process.
Stops leader selection process.
Indicates whether the instance is the leader or not.
elected when instance becomes the leader
revoked when instance gets revoked from its leadership
extended when instance's leadership ttl gets extended
error when an error occurred at a redis client
FAQs
A Leader selection module using redlock distributed lock algorithm
The npm package redlock-leader receives a total of 4 weekly downloads. As such, redlock-leader popularity was classified as not popular.
We found that redlock-leader 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.