Store delivery and archive times without the monotonic reading (closes #529)
check / check (push) Waiting to run

finished_at, archived_at and the updated_at stamp a re-dispatch
writes came from a bare time.Now(). The SQLite driver stores a time
as time.Time.String(), which appends the monotonic clock reading
(" m=+…") to a time read from time.Now(). All three now come from
GORM's own clock, NowFunc(), which stamps created_at, so they are
stored in the same form. The tests for each write read the stored
text back.

Model: opus-5-5
This commit was merged in pull request #533.
This commit is contained in:
2026-10-15 11:15:35 +02:00
parent 573f7f986a
commit f14fe02011
6 changed files with 55 additions and 7 deletions
+7 -3
View File
@@ -1701,8 +1701,11 @@ func writeDeliveryStatus(
database.DeliveryStatusFailed,
}).
Updates(map[string]any{
"status": status,
"finished_at": time.Now(),
"status": status,
// GORM's clock, the one that stamps created_at. A bare
// time.Now() carries a monotonic clock reading, which the
// driver would store as an " m=+…" suffix.
"finished_at": tx.NowFunc(),
})
if res.Error != nil || res.RowsAffected == 0 {
return res.Error
@@ -1906,12 +1909,13 @@ func (e *Engine) takeForRedispatch(
return false
}
// GORM's clock, as writeDeliveryStatus explains.
res := webhookDB.
Model(&database.Delivery{}).
Where(
"id = ? AND status = ?", deliveryID, eligible,
).
UpdateColumn("updated_at", time.Now())
UpdateColumn("updated_at", webhookDB.NowFunc())
if res.Error != nil {
e.log.Error(