fix(sync): replay interrupted messages immediately
This commit is contained in:
@@ -98,10 +98,12 @@ public sealed class SqliteOutboundStore : IOutboundStore
|
|||||||
{
|
{
|
||||||
await _db.CreateTableAsync<OutboundMessage>();
|
await _db.CreateTableAsync<OutboundMessage>();
|
||||||
// A process crash can leave rows in-flight after the broker accepted them but before
|
// 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(
|
await _db.ExecuteAsync(
|
||||||
"UPDATE outbound SET Status = ?, NextAttemptUnixMs = ? WHERE Status = ?",
|
"UPDATE outbound SET Status = ?, NextAttemptUnixMs = ? WHERE Status = ?",
|
||||||
(int)OutboundStatus.Pending, DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
(int)OutboundStatus.Pending, 0,
|
||||||
(int)OutboundStatus.InFlight);
|
(int)OutboundStatus.InFlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user