Skip to content

WebhookEvent has no index on eventType, status, or receivedAt #149

Description

@chonilius

WebhookEvent (src/common/entities/webhook-event.entity.ts) has only deliveryId uniquely indexed (implicitly, via unique: true) — there is no @Index on eventType, status, or receivedAt, despite this being an append-only, ever-growing audit table by design (every inbound webhook, verified or not, gets a row per the entity's own doc comment: "Audit log of every inbound webhook ... for replay/debugging").

Any future operational tooling — an admin view listing recent FAILED events for triage, a metrics job counting events by type/day, or simply an engineer debugging "did webhook X for repo Y ever arrive" by filtering on eventType/receivedAt — will full-scan this table, which by its very nature never stops growing (nothing deletes old rows, unlike IdempotencyKey's TTL-based cleanup).

Fix: add a composite index on (eventType, status) and a separate index on receivedAt (or a composite covering common "recent failures" queries like (status, receivedAt)).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programdocumentationImprovements or additions to documentationhelp wantedExtra attention is neededperformancePerformance/optimization issuespikeOpen-ended research/investigation task

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions