Small improvements

This commit is contained in:
Andras Schmelczer 2025-05-24 13:56:06 +01:00
parent e0b83bbc7a
commit 383e2868c2
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
3 changed files with 6 additions and 4 deletions

View file

@ -60,7 +60,7 @@ export class SafeFileSystemOperations implements FileSystemOperations {
}
public async getFileSize(path: RelativePath): Promise<number> {
this.logger.debug(`Getting size of file '${path}'`);
// Logging this would be too noisy
return this.safeOperation(
path,
this.decorateToHoldLock(path, async () =>

View file

@ -292,7 +292,7 @@ export class Database {
return this.lastSeenUpdateIds.min;
}
public addLastSeenUpdateId(value: number): void {
public addSeenUpdateId(value: number): void {
const previousMin = this.lastSeenUpdateIds.min;
this.lastSeenUpdateIds.add(value);
if (previousMin !== this.lastSeenUpdateIds.min) {

View file

@ -385,7 +385,8 @@ export class Syncer {
let hasLockToRelease = false;
if (document === undefined) {
// Let's avoid the same documents getting created in parallel multiple times
// Let's avoid the same documents getting created in parallel multiple times.
// There might be multiple tasks waiting for the lock
await this.remoteDocumentsLock.waitForLock(
remoteVersion.documentId
);
@ -396,6 +397,7 @@ export class Syncer {
}
try {
// We're either the first one to get the lock, so we have to create the document in `unrestrictedSyncRemotelyUpdatedFile`
if (document === undefined) {
await this.syncQueue.add(async () =>
this.internalSyncer.unrestrictedSyncRemotelyUpdatedFile(
@ -427,7 +429,7 @@ export class Syncer {
}
}
this.database.addLastSeenUpdateId(remoteVersion.vaultUpdateId);
this.database.addSeenUpdateId(remoteVersion.vaultUpdateId);
} finally {
if (hasLockToRelease) {
this.remoteDocumentsLock.unlock(remoteVersion.documentId);