Store delivery and archive times without the monotonic reading (closes #529)
check / check (push) Waiting to run
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 is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user