The high-score endpoints previously accepted unbounded request bodies and ran SQLite work directly in async handlers, allowing oversized input or database contention to consume server resources. Add a 1 KiB route body limit, admit only one database operation at a time, shed excess requests with a clear 503, and run accepted SQLite work on blocking threads while retaining admission until that work finishes. Extend the Nginx example with matching request, connection, body, and proxy time limits, and cover the limits, health availability, contention, and cancellation behavior with tests. Test Plan: - `just --justfile tdkpin-rs/justfile test` -- passed (144 tests) - `just --justfile tdkpin-rs/justfile clippy` -- passed - `cargo +nightly fmt --manifest-path tdkpin-rs/highscore-server/Cargo.toml -- --check` -- passed - `rumdl check --flavor commonmark tdkpin-rs/highscore-server/README.md` -- passed - `git diff --cached --check` -- passed
27 lines
615 B
TOML
27 lines
615 B
TOML
[package]
|
|
name = "tdkpin-highscore-server"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
publish = false
|
|
|
|
[dependencies]
|
|
axum = "0.8"
|
|
rusqlite = { version = "0.40", features = ["bundled"] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "sync"] }
|
|
|
|
[dev-dependencies]
|
|
http-body-util = "0.1"
|
|
tempfile = "3"
|
|
tokio = { version = "1", features = ["time"] }
|
|
tower = { version = "0.5", features = ["util"] }
|
|
|
|
[lints.clippy]
|
|
pedantic = { level = "warn", priority = -1 }
|
|
todo = "warn"
|
|
unwrap_used = "warn"
|
|
|
|
[lints.rust]
|
|
unsafe_code = "forbid"
|