From db2439c52e807731199b4c1f62c1658b36ec4951 Mon Sep 17 00:00:00 2001 From: Brent Perteet Date: Mon, 24 Aug 2026 17:05:36 -0500 Subject: [PATCH] fix(sync): replay interrupted messages immediately --- src/FieldLogger.Sync/OutboundStore.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/FieldLogger.Sync/OutboundStore.cs b/src/FieldLogger.Sync/OutboundStore.cs index d2c31e4..2d5b069 100644 --- a/src/FieldLogger.Sync/OutboundStore.cs +++ b/src/FieldLogger.Sync/OutboundStore.cs @@ -98,10 +98,12 @@ public sealed class SqliteOutboundStore : IOutboundStore { await _db.CreateTableAsync(); // A process crash can leave rows in-flight after the broker accepted them but before - // the application ack was applied. Requeue them; pointId makes the replay idempotent. + // the application ack was applied. Requeue them for immediate replay; pointId makes + // the replay idempotent. A zero due-time also keeps recovery independent of whichever + // clock implementation the sync engine uses. await _db.ExecuteAsync( "UPDATE outbound SET Status = ?, NextAttemptUnixMs = ? WHERE Status = ?", - (int)OutboundStatus.Pending, DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), + (int)OutboundStatus.Pending, 0, (int)OutboundStatus.InFlight); }