Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@clickup/distributed-locker
Advanced tools
Ensures that some long-running job with an unique key is not double scheduled in the cluster.
See also Full API documentation.
As opposed to the popular redlock algorithm, the library also tracks per-process liveness (in a separate Node thread), so the locks from a dead process are quickly reported as free to the rest of the cluster as soon as the process dies. This is extremely convenient when doing cluster-wide deployments or individual worker process restarts.
Main features:
export const db = new RedisDatabase(
// You can also use Redis Cluster here.
new Redis({
host: process.env.REDIS_WORKER_HOST,
port: process.env.REDIS_WORKER_PORT,
password: process.env.REDIS_WORKER_PASSWORD,
keyPrefix: "locker:",
})
);
const locker = new Locker({
database: {
moduleName: __file,
exportName: "db",
},
});
// ...
const res = await locker.acquireAndRun("job-key", async (heartbeat) => {
while (shouldContinue()) {
await doSomeWork();
// 1. Reports that the job is still running to refresh the lock.
// 2. If someone takes over (e.g. a network blip or event loop
// blockage), kills itself by throwing LockError exception.
await heartbeat();
}
});
// res is now either { status: LockStatus.SUCCESS }
// or { status: LockStatus.SOMEONE_ELSE_HOLDS_LOCK }
FAQs
Ensures that some long-running job with an unique key is not double scheduled in the cluster.
We found that @clickup/distributed-locker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.