Skip to content

perf(api): limit reply failure lookup rows - #14

Merged
thomasorgeval merged 1 commit into
mainfrom
bolt-optimizer/reply-failure-query
Jun 22, 2026
Merged

perf(api): limit reply failure lookup rows#14
thomasorgeval merged 1 commit into
mainfrom
bolt-optimizer/reply-failure-query

Conversation

@thomasorgeval

Copy link
Copy Markdown
Member

Summary

  • Use PostgreSQL DISTINCT ON when loading latest publish_failed audit events for Reply Inbox reviews.
  • Caps the secondary failure lookup to at most one row per visible review instead of returning every historical publish failure and deduplicating in application code.

Expected impact

  • Reduces database result transfer and API-side allocation for Reply Inbox loads when reviews have repeated publish failures.
  • The improvement is unmeasured locally because a representative database with high retry/failure volume is needed; behavior should be equivalent because ordering still selects the newest failure per Review.

Verification

  • pnpm nx typecheck api --skip-nx-cache
  • pnpm lint

@thomasorgeval
thomasorgeval marked this pull request as ready for review June 22, 2026 08:26
@thomasorgeval
thomasorgeval merged commit 3abb676 into main Jun 22, 2026
1 check passed
@thomasorgeval
thomasorgeval deleted the bolt-optimizer/reply-failure-query branch June 22, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant