This commit is contained in:
Andras Schmelczer 2025-01-06 22:41:39 +00:00
commit ac0296570f
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
2 changed files with 18 additions and 0 deletions

View file

@ -9,28 +9,40 @@ export class ObsidianFileOperations implements FileOperations {
public async listAllFiles(): Promise<RelativePath[]> { public async listAllFiles(): Promise<RelativePath[]> {
console.log("before getFiles"); console.log("before getFiles");
await sleep(1000);
const files = this.vault.getFiles(); const files = this.vault.getFiles();
console.log("after getFiles"); console.log("after getFiles");
await sleep(1000);
console.log(files); console.log(files);
return files.map((file) => file.path); return files.map((file) => file.path);
} }
public async read(path: RelativePath): Promise<Uint8Array> { public async read(path: RelativePath): Promise<Uint8Array> {
console.log("before readBinary"); console.log("before readBinary");
await sleep(1000);
const result = new Uint8Array( const result = new Uint8Array(
await this.vault.adapter.readBinary(normalizePath(path)) await this.vault.adapter.readBinary(normalizePath(path))
); );
console.log("after readBinary"); console.log("after readBinary");
await sleep(1000);
return result; return result;
} }
public async getModificationTime(path: RelativePath): Promise<Date> { public async getModificationTime(path: RelativePath): Promise<Date> {
console.log("before stat"); console.log("before stat");
await sleep(1000);
const file = await this.vault.adapter.stat(normalizePath(path)); const file = await this.vault.adapter.stat(normalizePath(path));
if (!file) { if (!file) {
throw new Error(`File not found: ${path}`); throw new Error(`File not found: ${path}`);
} }
console.log("after stat"); console.log("after stat");
await sleep(1000);
return new Date(file.mtime); return new Date(file.mtime);
} }

View file

@ -300,13 +300,17 @@ export class Syncer {
`Document metadata not found for ${relativePath}. This implies a corrupt local database. Consider resetting the plugin's sync history.` `Document metadata not found for ${relativePath}. This implies a corrupt local database. Consider resetting the plugin's sync history.`
); );
} }
await sleep(1000);
console.log("about to read", relativePath); console.log("about to read", relativePath);
await sleep(1000);
const contentBytes = await this.operations.read(relativePath); const contentBytes = await this.operations.read(relativePath);
console.log("has read", relativePath); console.log("has read", relativePath);
await sleep(1000);
let contentHash = hash(contentBytes); let contentHash = hash(contentBytes);
console.log("has hashed", relativePath); console.log("has hashed", relativePath);
await sleep(1000);
if ( if (
localMetadata.hash === contentHash && localMetadata.hash === contentHash &&
@ -322,6 +326,7 @@ export class Syncer {
} }
console.log("about to send", relativePath); console.log("about to send", relativePath);
await sleep(1000);
const response = await this.syncService.put({ const response = await this.syncService.put({
documentId: localMetadata.documentId, documentId: localMetadata.documentId,
@ -332,6 +337,7 @@ export class Syncer {
}); });
console.log("has sent", relativePath); console.log("has sent", relativePath);
await sleep(1000);
this.history.addHistoryEntry({ this.history.addHistoryEntry({
status: SyncStatus.SUCCESS, status: SyncStatus.SUCCESS,