Resubmit a stored event as a new undelivered event (closes #250)
All checks were successful
check / check (push) Successful in 3m1s

This commit was merged in pull request #251.
This commit is contained in:
2026-08-24 00:53:37 +02:00
parent a83e8fe654
commit 89f3b984d2
11 changed files with 1279 additions and 148 deletions

View File

@@ -20,6 +20,7 @@ const maxRenderedBodyBytes = 8192
// rather than in Go is the point of the projection — an
// oversized body never becomes a Go string at all.
const eventLogColumns = "id, created_at, method, content_type, " +
"resubmitted_from_id, " +
"substr(cast(body as blob), 1, ?) AS body, " +
"length(cast(body as blob)) AS body_bytes"
@@ -45,9 +46,25 @@ type EventLogView struct {
// than the cap, so the page owes the reader a marker.
BodyTruncated bool
// ResubmittedFromID names the event this one was copied
// from, empty for an event that arrived on the receiver.
ResubmittedFromID string
// ResubmitCount is how many events have been resubmitted
// from this one. Both directions are shown, because after
// a few resubmits of one captured event the log is
// otherwise a row of identical bodies with nothing saying
// which came from which.
ResubmitCount int
Deliveries []DeliveryView
}
// ResubmittedFrom reports that this event is a copy of another.
func (v EventLogView) ResubmittedFrom() bool {
return v.ResubmittedFromID != ""
}
// BodyShownBytes is how many body bytes the page is actually
// rendering, which the truncation marker reports beside the
// true size.
@@ -59,12 +76,13 @@ func (v EventLogView) BodyShownBytes() int {
// body column arrives already cut to the cap by SQLite, with
// the true size beside it.
type eventLogRow struct {
ID string
CreatedAt time.Time
Method string
ContentType string
Body []byte
BodyBytes int64
ID string
CreatedAt time.Time
Method string
ContentType string
ResubmittedFromID *string
Body []byte
BodyBytes int64
}
// view projects a loaded row for rendering.
@@ -79,14 +97,20 @@ func (r *eventLogRow) view() EventLogView {
body = trimPartialRune(body)
}
var from string
if r.ResubmittedFromID != nil {
from = *r.ResubmittedFromID
}
return EventLogView{
ID: r.ID,
CreatedAt: r.CreatedAt,
Method: r.Method,
ContentType: r.ContentType,
Body: string(body),
BodyBytes: r.BodyBytes,
BodyTruncated: truncated,
ID: r.ID,
CreatedAt: r.CreatedAt,
Method: r.Method,
ContentType: r.ContentType,
Body: string(body),
BodyBytes: r.BodyBytes,
BodyTruncated: truncated,
ResubmittedFromID: from,
}
}