{"library":"mongo-dlock","type":"library","category":null,"description":"Distributed lock implementation based on MongoDB for Node.js, version 2.0.4. It supports one-shot lock attempts and automatic retry via polling, lock refresh (including auto-refresh), and data payloads attached to locks. Uses MongoDB TTL indexes to clean up stray locks. The 2.0.0 major release removed pubsub-based event propagation via a capped collection and EventEmitter, simplifying the internals to rely solely on polling. Compared to alternatives like Redis-based locks, mongo-dlock leverages existing MongoDB infrastructure without additional services. It defaults to a 15-second lock expiration and a 5-second polling interval.","language":"javascript","status":"active","version":"2.0.4","tags":["javascript","lock","distributed","mongodb"],"last_verified":"Sun Jun 07","install":[{"cmd":"npm install mongo-dlock","imports":["import MDL from 'mongo-dlock'","import MDL from 'mongo-dlock'; const mongoDLock = await new Promise((resolve, reject) => MDL(opts, (err, v) => err ? reject(err) : resolve(v)))","import MDL from 'mongo-dlock'; const mongoDLock = await ...; const dlock = mongoDLock.dlock('task')"]},{"cmd":"yarn add mongo-dlock","imports":[]},{"cmd":"pnpm add mongo-dlock","imports":[]}],"homepage":"https://codeberg.org/pepmartinez/mongo-dlock","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"mongo-dlock","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":null}