Skip to content

Handle brief traffic bursts and streamline review ratings - #75

Merged
pyroprocyon merged 3 commits into
mainfrom
codex/revue-capacity-hotspots
Dec 6, 2026
Merged

pyroprocyon merged 3 commits into
mainfrom
codex/revue-capacity-hotspots

Conversation

@pyroprocyon

Copy link
Copy Markdown
Owner

Problem

A brief burst of sign-ins or public catalog reads could receive an immediate busy response as soon as all active slots were in use. Successful ratings also fetched card text they did not return and built fresh JSON mappers to read and write the saved FSRS state.

What changes

  • Allow two sign-in requests to wait for up to two seconds before spending a shared attempt. The server still admits one active password verification per replica.
  • Allow one public catalog API read to wait for up to 200 ms when all three active permits are occupied.
  • Fetch the current card text only when the displayed version differs. The rating still uses the locked snapshot, and a conflict returns the full current card.
  • Reuse a mapper with the FSRS library's saved-state settings so existing schedules can resume with the same dates and serialized state.

Decisions worth a look

Small waiting limits trade a short wait for fewer immediate rejections. At Free-sized local limits, first-attempt success in three 20-person sign-in bursts went from one per burst to two or three. That result still calls for staggered classroom sign-in.

Verification

The pre-push gate ran the full local build, lint, backend, browser, and SonarQube checks, and GitGuardian scanned the complete outgoing commit range.

In a local replay at 0.15 CPU and 512 MiB, the median of five 20-learner rating-wave p95s fell from 2.01 s to 1.64 s after the FSRS mapper change. All 150 acknowledgements per build matched one review log and one schedule advance. This comparison used local PostgreSQL with added database latency.

Manual check

Open a personal deck in two tabs. Start a review in one, edit its current card in the other, and then rate the old question. The review should show the revised card and leave the schedule untouched until the learner rates the new version.

@pyroprocyon
pyroprocyon marked this pull request as ready for review December 6, 2026 01:01
@pyroprocyon
pyroprocyon merged commit f533b5e into main Dec 6, 2026
9 checks passed
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