Skip to content

Commit

Permalink
fix: remove uuid dependency in favor of built-in crypto randomUUID
Browse files Browse the repository at this point in the history
  • Loading branch information
AVVS committed Jan 19, 2025
1 parent 302116a commit 281ddfc
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
"type": "git",
"url": "https://github.com/microfleet/ioredis-lock.git"
},
"dependencies": {
"uuid": "^11.0.5"
},
"peerDependencies": {
"ioredis": "~4.x.x || ~5.x.x"
},
Expand Down
12 changes: 0 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/lock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { v4 } from 'uuid'
import { randomUUID } from 'node:crypto'
import { LockAcquisitionError, LockReleaseError, LockExtendError } from './errors.js'
import { setTimeout as delay } from 'node:timers/promises'
import * as scripts from './scripts.js'
Expand Down Expand Up @@ -28,7 +28,7 @@ function getRandomArbitrary(min: number, max: number): number {
export class Lock {
static _acquiredLocks: Set<Lock> = new Set()

private readonly _id: string = v4()
private readonly _id: string = randomUUID()
private readonly _client: Redis | Cluster
private _locked = false
private _key: string | null = null
Expand Down

0 comments on commit 281ddfc

Please sign in to comment.