Documentation
¶
Overview ¶
Package hitlworker runs the periodic sweep that finalizes pending_approval messages whose TTL has elapsed. Each row becomes either expired_approved (sent as-is) or expired_rejected based on the owning agent's hitl_expiration_action column. Body columns are scrubbed in both cases.
Index ¶
Constants ¶
const DefaultBatchSize = 100
DefaultBatchSize caps how many rows one sweep will try to finalize. The partial index on (approval_expires_at) WHERE status='pending_approval' keeps the list query cheap regardless of total table size.
const DefaultInterval = 60 * time.Second
DefaultInterval is the sweep cadence. One minute matches the design doc target; short enough that TTL boundaries are honored within a minute, long enough to avoid hot-looping the DB when there's nothing to do.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker runs the TTL sweep. Construct with New, start with Run.
func New ¶
func New(store *identity.Store, sender *outbound.Sender, usage usage.UsageTracker, fromDomain string) *Worker
New constructs a Worker. fromDomain is the deployment's outbound from-domain (cfg.OutboundSMTP.FromDomain) — used by the self-send loopback branch to stamp the synthetic Message-ID / Received headers the same way internal/agent does on the user-driven approve path. Pass "" if the deployment has no outbound relay configured; the loopback path falls back to "e2a.local" for the host portion.