Skip to content

Commit

Permalink
use Date instead of performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Webster committed Nov 15, 2024
1 parent bc0e2d9 commit 102d767
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libraries/FileLock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function waitForLock(path: string, options: InternalServerOptions):
retries++;
try {
const stat = await fsPromises.stat(lockPath)
if (performance.now() - stat.mtime.getTime() > mtimeLimit) {
if (Date.now() - stat.mtime.getTime() > mtimeLimit) {
return
} else {
await new Promise(resolve => setTimeout(resolve, options.lockRetryWait))
Expand Down Expand Up @@ -52,7 +52,7 @@ export async function lockFile(path: string): Promise<() => Promise<void>> {
if (e.code === 'EEXIST') {
try {
const stat = await fsPromises.stat(lockPath)
if (performance.now() - stat.mtime.getTime() > mtimeLimit) {
if (Date.now() - stat.mtime.getTime() > mtimeLimit) {
return setupMTimeEditor(lockPath)
} else {
throw 'LOCKED'
Expand Down

0 comments on commit 102d767

Please sign in to comment.