Skip to content

Reduce notification timeout long tail#990

Merged
raymondjacobson merged 1 commit into
mainfrom
codex/notification-timeout-quick-win
Jul 7, 2026
Merged

Reduce notification timeout long tail#990
raymondjacobson merged 1 commit into
mainfrom
codex/notification-timeout-quick-win

Conversation

@raymondjacobson

Copy link
Copy Markdown
Member

Summary

  • use a smaller candidate window for timestamp pagination so old notification scrollback does not read tens of thousands of historical rows before grouping
  • give unread polling its own shorter timeout and return a conservative capped unread response instead of surfacing a 504 when the multi-recipient array path is cold

Production evidence

  • slow dEKBy cursor with the existing 25k candidate window read ~23.4k rows and built ~2.9k groups before trimming
  • the same cursor with a 2k candidate window still produced >600 groups and planned/executed in ~51ms warm during read-only production probing
  • unread timeout case for user 843 was dominated by the multi-recipient GIN path scanning ~42k historical rows to find 7 current unread rows, so this PR fails closed for the poll while we plan the recipient-normalized/index follow-up

Validation

  • go test ./api -run '^$'
  • git diff --check

Notes

  • go test ./api -run TestV1Notifications is blocked locally because Postgres on localhost:21300 refused connections

@raymondjacobson raymondjacobson merged commit b41b865 into main Jul 7, 2026
2 checks passed
@raymondjacobson raymondjacobson deleted the codex/notification-timeout-quick-win branch July 7, 2026 23:26
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