MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / DeleteExpiredWebhookEvents

Method DeleteExpiredWebhookEvents

internal/webhookpub/outbox.go:148–158  ·  view source on GitHub ↗

DeleteExpiredWebhookEvents removes terminal rows whose expires_at has passed. Migration 026 sets a 30-day TTL on every event row; without this janitor the table grows monotonically and the (user_id, created_at) index degrades. Mirrors webhook.SubscriberStore.DeleteExpiredSubscriberDeliveries for the

(ctx context.Context)

Source from the content-addressed store, hash-verified

146// fall out at day 30. That's the "page ops after many attempts" case
147// recordFailure calls out — preferable to silent loss.
148func (o *outbox) DeleteExpiredWebhookEvents(ctx context.Context) (int, error) {
149 tag, err := o.pool.Exec(ctx,
150 `DELETE FROM webhook_events
151 WHERE expires_at <= now()
152 AND status <> 'pending'`,
153 )
154 if err != nil {
155 return 0, fmt.Errorf("delete expired webhook_events: %w", err)
156 }
157 return int(tag.RowsAffected()), nil
158}
159
160func (o *outbox) PublishBestEffortTx(ctx context.Context, tx pgx.Tx, e Event) (wrote bool) {
161 if !o.flag.Enabled() {

Callers

nothing calls this directly

Calls 1

ExecMethod · 0.65

Tested by

no test coverage detected