fix 'Out of sync' error
This commit is contained in:
parent
3fee9cbb42
commit
b1a48f4f27
2 changed files with 10 additions and 3 deletions
11
app-sync.js
11
app-sync.js
|
@ -139,9 +139,16 @@ app.post('/sync', async (req, res) => {
|
||||||
for (let i = 0; i < newMessages.length; i++) {
|
for (let i = 0; i < newMessages.length; i++) {
|
||||||
let msg = newMessages[i];
|
let msg = newMessages[i];
|
||||||
let envelopePb = new SyncPb.MessageEnvelope();
|
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.setTimestamp(msg.timestamp);
|
||||||
envelopePb.setIsencrypted(msg.is_encrypted === 1);
|
envelopePb.setContent(messagePb.serializeBinary());
|
||||||
envelopePb.setContent(msg.content);
|
|
||||||
responsePb.addMessages(envelopePb);
|
responsePb.addMessages(envelopePb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
return {
|
||||||
trie: actual.internal.timestamp.getClock().merkle,
|
trie: actual.internal.timestamp.getClock().merkle,
|
||||||
|
|
Loading…
Reference in a new issue