node-redlock
Advanced tools
Comparing version 1.1.0 to 2.0.0
{ | ||
"name": "node-redlock", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "A distributed locking algorithm used to manage distributed resources in a system.", | ||
@@ -8,5 +8,5 @@ "main": "redlock.js", | ||
"scripts": { | ||
"build": "tsc -b", | ||
"test": "mocha -r ts-node/register tests/**/*.test.ts", | ||
"lint": "eslint . --ext .ts" | ||
"build": "tsc -b && cp package.json dist && cp README.md dist", | ||
"test": "mocha -r ts-node/register test/**/*.test.ts", | ||
"lint": "eslint . --ext .ts --fix" | ||
}, | ||
@@ -25,3 +25,3 @@ "keywords": [ | ||
"randomstring": "^1.2.1", | ||
"redis": "^3.1.2" | ||
"redis": "^4.6.14" | ||
}, | ||
@@ -28,0 +28,0 @@ "devDependencies": { |
@@ -60,36 +60,1 @@ "use strict"; | ||
exports.Redlock = Redlock; | ||
// // Usage example | ||
// import Redis from 'ioredis'; | ||
// import { createClient } from 'redis'; | ||
// import { IoredisClient } from './IoredisClient'; | ||
// import { RedisjsClient } from './RedisjsClient'; | ||
// (async () => { | ||
// const ioredisClients = [ | ||
// new Redis({ host: 'localhost', port: 6379 }), | ||
// new Redis({ host: 'localhost', port: 6380 }), | ||
// new Redis({ host: 'localhost', port: 6381 }), | ||
// ].map(client => new IoredisClient(client)); | ||
// const redisjsClients = [ | ||
// createClient({ url: 'redis://localhost:6379' }), | ||
// createClient({ url: 'redis://localhost:6380' }), | ||
// createClient({ url: 'redis://localhost:6381' }), | ||
// ]; | ||
// await Promise.all(redisjsClients.map(client => client.connect())); | ||
// const redisjsClientInstances = redisjsClients.map(client => new RedisjsClient(client)); | ||
// // Choose the set of clients you want to use | ||
// const clients = [...ioredisClients, ...redisjsClientInstances]; | ||
// const redlock = new Redlock(clients); | ||
// const resource = 'locks:example'; | ||
// const ttl = 10000; // 10 seconds | ||
// const lock = await redlock.acquireLock(resource, ttl); | ||
// if (lock) { | ||
// console.log(`Acquired lock on ${resource}`); | ||
// // Do your critical section work here | ||
// await redlock.releaseLock(resource, lock.value); | ||
// console.log(`Released lock on ${resource}`); | ||
// } else { | ||
// console.log(`Failed to acquire lock on ${resource}`); | ||
// } | ||
// ioredisClients.forEach(client => (client as IoredisClient).client.quit()); | ||
// await Promise.all(redisjsClients.map(client => client.quit())); | ||
// })(); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
21
18002
373
+ Added@redis/bloom@1.2.0(transitive)
+ Added@redis/client@1.6.0(transitive)
+ Added@redis/graph@1.1.1(transitive)
+ Added@redis/json@1.0.7(transitive)
+ Added@redis/search@1.2.0(transitive)
+ Added@redis/time-series@1.1.0(transitive)
+ Addedgeneric-pool@3.9.0(transitive)
+ Addedredis@4.7.0(transitive)
+ Addedyallist@4.0.0(transitive)
- Removeddenque@1.5.1(transitive)
- Removedredis@3.1.2(transitive)
- Removedredis-commands@1.7.0(transitive)
Updatedredis@^4.6.14