diff --git a/frontend/sync-client/src/file-operations/safe-filesystem-operations.ts b/frontend/sync-client/src/file-operations/safe-filesystem-operations.ts index 5f578dc3..8b2a547a 100644 --- a/frontend/sync-client/src/file-operations/safe-filesystem-operations.ts +++ b/frontend/sync-client/src/file-operations/safe-filesystem-operations.ts @@ -1,7 +1,7 @@ import type { RelativePath } from "../persistence/database"; import type { FileSystemOperations } from "./filesystem-operations"; import type { Logger } from "../tracing/logger"; -import { DocumentLocks } from "./document-locks"; +import { Locks } from "../utils/locks"; import { FileNotFoundError } from "./file-not-found-error"; /** @@ -10,13 +10,13 @@ import { FileNotFoundError } from "./file-not-found-error"; * single request in-flight for any one file through the use of locks. */ export class SafeFileSystemOperations implements FileSystemOperations { - private readonly locks: DocumentLocks; + private readonly locks: Locks; public constructor( private readonly fs: FileSystemOperations, private readonly logger: Logger ) { - this.locks = new DocumentLocks(logger); + this.locks = new Locks(logger); } public async listAllFiles(): Promise { @@ -117,7 +117,7 @@ export class SafeFileSystemOperations implements FileSystemOperations { : [pathOrPaths]; await Promise.all( - paths.map(async (path) => this.locks.waitForDocumentLock(path)) + paths.map(async (path) => this.locks.waitForLock(path)) ); try { @@ -125,7 +125,7 @@ export class SafeFileSystemOperations implements FileSystemOperations { } finally { await Promise.all( paths.map((path) => { - this.locks.unlockDocument(path); + this.locks.unlock(path); }) ); }