Финальная версия синхронизации

This commit is contained in:
RoyceDa
2026-02-16 13:25:38 +02:00
parent 4a505ab974
commit 1efac74e27
2 changed files with 10 additions and 4 deletions

View File

@@ -70,10 +70,8 @@ export function useDialogFiber() {
}
await runQuery(
"INSERT INTO accounts_sync_times (account, last_sync) VALUES (?, ?) " +
"ON CONFLICT(account) DO UPDATE SET last_sync = CASE " +
"WHEN excluded.last_sync > last_sync THEN excluded.last_sync " +
"ELSE last_sync END",
[publicKey, timestamp]
"ON CONFLICT(account) DO UPDATE SET last_sync = ?",
[publicKey, timestamp, timestamp]
);
};
@@ -580,6 +578,7 @@ export function useDialogFiber() {
const messageId = packet.getMessageId();
await runQuery(`UPDATE messages SET delivered = ?, timestamp = ? WHERE message_id = ? AND account = ?`, [DeliveredMessageState.DELIVERED, Date.now(), messageId, publicKey]);
updateDialog(packet.getToPublicKey());
updateSyncTime(Date.now());
log("Delivery packet received msg id " + messageId);
addOrUpdateDialogCache(packet.getToPublicKey(), getDialogCache(packet.getToPublicKey()).map((message) => {
if (message.message_id == messageId) {