test(client): cover digital employee sync retries
This commit is contained in:
@@ -183,7 +183,7 @@ export async function flushDigitalEmployeeSyncOutbox(
|
||||
: [];
|
||||
recordSyncAttempts(syncedRows, config, "synced", null, startedAt, finishedAt);
|
||||
if (acked.length > 0) {
|
||||
markRowsSynced(acked, finishedAt);
|
||||
markRowsSynced(acked, finishedAt, rows);
|
||||
} else {
|
||||
markRowsSynced(
|
||||
rows.map((row) => ({
|
||||
@@ -380,7 +380,11 @@ function markRowsSyncing(rows: OutboxRow[], now: string): void {
|
||||
tx();
|
||||
}
|
||||
|
||||
function markRowsSynced(acks: SyncAck[], now: string): void {
|
||||
function markRowsSynced(
|
||||
acks: SyncAck[],
|
||||
now: string,
|
||||
sourceRows: OutboxRow[] = [],
|
||||
): void {
|
||||
const db = getDb();
|
||||
if (!db) return;
|
||||
const tx = db.transaction(() => {
|
||||
@@ -390,7 +394,10 @@ function markRowsSynced(acks: SyncAck[], now: string): void {
|
||||
WHERE id = ?
|
||||
`);
|
||||
for (const ack of acks) {
|
||||
const outboxId = ack.outbox_id || ack.id;
|
||||
const outboxId =
|
||||
ack.outbox_id ||
|
||||
ack.id ||
|
||||
sourceRows.find((row) => ackMatchesRow(ack, row))?.id;
|
||||
if (!outboxId) continue;
|
||||
outboxStmt.run(now, outboxId);
|
||||
updateEntitySyncStatus(ack, now);
|
||||
|
||||
Reference in New Issue
Block a user