Skip to content

traverse-server: the pkarr rate limiters read an injected clock - #509

Merged
Tryanks merged 1 commit into
mainfrom
traverse-server/deterministic-rate-limit-test
Sep 22, 2026
Merged

Tryanks merged 1 commit into
mainfrom
traverse-server/deterministic-rate-limit-test

Conversation

@Tryanks

@Tryanks Tryanks commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • manifest_and_pkarr_store_over_http measured a 1 token/s token bucket against the wall clock. A PUT commits a redb transaction (fsync), so on a slow Windows runner more than a second passed between GETs, a token refilled, and the expected 429 came back 200. It failed twice today on unrelated branches (ui: walk back into a landed history page inside the render, not between frames #507 and orchestrate/sol-executor).
  • RateLimiter now reads an injected Clock (Instant::now in production); Server::spawn_with_clock threads it through. The integration test freezes the clock so bursts are consumed by request count alone.

Test plan

  • cargo test -p tcode-traverse-server: all pass. Clippy clean, fmt applied.

manifest_and_pkarr_store_over_http asserts the fourth GET and the fourth
PUT are refused, with buckets of three tokens refilled at one per second
against the wall clock. A PUT commits a redb transaction with fsync; on a
slow Windows runner the sequence took over a second, a token refilled and
the request passed with 200. The test failed twice today on unrelated
branches.

RateLimiter now takes a Clock (Instant::now in production) and
Server::spawn_with_clock threads it through. The integration test freezes
the clock, so its bursts are consumed by request count alone. The unit
test keeps driving allow_at with explicit instants.
@Tryanks
Tryanks merged commit 8d14d51 into main Sep 22, 2026
7 checks passed
@Tryanks
Tryanks deleted the traverse-server/deterministic-rate-limit-test branch September 22, 2026 19:08
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