fix 'Out of sync' error

This commit is contained in:
brend 2022-05-29 22:30:06 +03:00 committed by James Long
parent 3fee9cbb42
commit b1a48f4f27
2 changed files with 10 additions and 3 deletions

View file

@ -139,9 +139,16 @@ app.post('/sync', async (req, res) => {
for (let i = 0; i < newMessages.length; i++) {
let msg = newMessages[i];
let envelopePb = new SyncPb.MessageEnvelope();
let messagePb = new SyncPb.Message();
messagePb.setDataset(msg.dataset);
messagePb.setRow(msg.row);
messagePb.setColumn(msg.column);
messagePb.setValue(msg.value);
envelopePb.setTimestamp(msg.timestamp);
envelopePb.setIsencrypted(msg.is_encrypted === 1);
envelopePb.setContent(msg.content);
envelopePb.setContent(messagePb.serializeBinary());
responsePb.addMessages(envelopePb);
}

View file

@ -27,7 +27,7 @@ const sync = sequential(async function syncAPI(messages, since, fileId) {
};
});
let newMessages = actual.internal.syncAndReceiveMessages(messages, since);
let newMessages = await actual.internal.syncAndReceiveMessages(messages, since);
return {
trie: actual.internal.timestamp.getClock().merkle,