Add log lines
This commit is contained in:
parent
b713a83c3f
commit
5c6c3652ae
1 changed files with 16 additions and 0 deletions
|
|
@ -284,6 +284,7 @@ export class Syncer {
|
||||||
const localMetadata = this.database.getDocument(
|
const localMetadata = this.database.getDocument(
|
||||||
oldPath ?? relativePath
|
oldPath ?? relativePath
|
||||||
);
|
);
|
||||||
|
console.log(JSON.stringify(localMetadata));
|
||||||
if (!localMetadata) {
|
if (!localMetadata) {
|
||||||
if (this.database.getDocument(relativePath)) {
|
if (this.database.getDocument(relativePath)) {
|
||||||
this.history.addHistoryEntry({
|
this.history.addHistoryEntry({
|
||||||
|
|
@ -299,9 +300,13 @@ 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.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
console.log("about to read", relativePath);
|
||||||
|
|
||||||
const contentBytes = await this.operations.read(relativePath);
|
const contentBytes = await this.operations.read(relativePath);
|
||||||
|
console.log("has read", relativePath);
|
||||||
|
|
||||||
let contentHash = hash(contentBytes);
|
let contentHash = hash(contentBytes);
|
||||||
|
console.log("has hashed", relativePath);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
localMetadata.hash === contentHash &&
|
localMetadata.hash === contentHash &&
|
||||||
|
|
@ -316,6 +321,8 @@ export class Syncer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("about to send", relativePath);
|
||||||
|
|
||||||
const response = await this.syncService.put({
|
const response = await this.syncService.put({
|
||||||
documentId: localMetadata.documentId,
|
documentId: localMetadata.documentId,
|
||||||
parentVersionId: localMetadata.parentVersionId,
|
parentVersionId: localMetadata.parentVersionId,
|
||||||
|
|
@ -324,6 +331,8 @@ export class Syncer {
|
||||||
createdDate: updateTime
|
createdDate: updateTime
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("has sent", relativePath);
|
||||||
|
|
||||||
this.history.addHistoryEntry({
|
this.history.addHistoryEntry({
|
||||||
status: SyncStatus.SUCCESS,
|
status: SyncStatus.SUCCESS,
|
||||||
source: SyncSource.PUSH,
|
source: SyncSource.PUSH,
|
||||||
|
|
@ -364,15 +373,22 @@ export class Syncer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.type === "MergingUpdate") {
|
if (response.type === "MergingUpdate") {
|
||||||
|
console.log(
|
||||||
|
"about to deserialize",
|
||||||
|
response.contentBase64
|
||||||
|
);
|
||||||
const responseBytes = deserialize(
|
const responseBytes = deserialize(
|
||||||
response.contentBase64
|
response.contentBase64
|
||||||
);
|
);
|
||||||
|
console.log("has deserialized", response.relativePath);
|
||||||
contentHash = hash(responseBytes);
|
contentHash = hash(responseBytes);
|
||||||
|
console.log("about to write", response.relativePath);
|
||||||
await this.operations.write(
|
await this.operations.write(
|
||||||
response.relativePath,
|
response.relativePath,
|
||||||
contentBytes,
|
contentBytes,
|
||||||
responseBytes
|
responseBytes
|
||||||
);
|
);
|
||||||
|
console.log("has written", response.relativePath);
|
||||||
|
|
||||||
this.history.addHistoryEntry({
|
this.history.addHistoryEntry({
|
||||||
status: SyncStatus.SUCCESS,
|
status: SyncStatus.SUCCESS,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue