[omp major] Tray reads LIST on hot path with O(n²) sort #157
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub#157
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
[omp major] Tray reads LIST on hot path with O(n²) sort
internal/notify/http.go:354-371,:381-390,:422-432: everyGET /notificationsLISTs the prefix + GETs up to 1000 overflow objects even when the index suffices, plus up to ~1050repoAliveHEADs, plus an O(n²) insertion sort.Fix
Index-first serving (answer from the unread index when it covers the window; LIST only for overflow pages), bound/skip the alive probes on the hot path (lazy or capped), replace the quadratic sort. Regression/benchmark test pinning per-request cost. Coverage gate holds.
Acceptance criteria
-race.Fixed by PR #163 (#163): index-first tray serving — covered pages cost 1 index GET + 1 HEAD per distinct repo, no LIST; LIST only for overflow pages; sort.Slice replaces the O(n²) sort. Cost tests verified failing pre-fix; -race green, coverage 96.1%.
PR #163 review (fix/issue-157, index-first tray reads) — verified in scratch worktree, all green.
CORRECTNESS
TRADE-OFF — accepted, one wording fix pushed
fbc46b4: now reads 'until its page is reached via overflow (paging past the window); retention reaps dead-repo overflow but never reindexes live orphans'. §1.2 liveness line ('memoized to one HEAD per distinct repo… since #157') verified accurate.COST PINS — genuine, verified both directions
RESULTS (scratch worktree /tmp/pr163 @
fbc46b4, since removed)MERGE RECOMMENDATION: ready to merge.
Fixed by PR #163 incl. review doc precision fix (index-first serving, lazy liveness, identical sort; 96.1% coverage), merged. Closing.