28 lines
968 B
Markdown
28 lines
968 B
Markdown
|
|
# Polish: Backend Quality
|
||
|
|
|
||
|
|
All changes built on dev server, not macOS: `./scripts/deploy-to-target.sh --live`
|
||
|
|
|
||
|
|
## Priority 1: Eliminate panics
|
||
|
|
```bash
|
||
|
|
ssh archipelago@192.168.1.228 "grep -rn 'unwrap()\|\.expect(' ~/archy/core/archipelago/src/ --include='*.rs' | grep -v test | grep -v '_test.rs'"
|
||
|
|
```
|
||
|
|
Replace with `?` + `.context()` or `.map_err()`.
|
||
|
|
|
||
|
|
## Priority 2: Add timeouts
|
||
|
|
- Container ops: `tokio::time::timeout(Duration::from_secs(30), op).await`
|
||
|
|
- HTTP/RPC calls: `reqwest::Client::builder().timeout(Duration::from_secs(10))`
|
||
|
|
|
||
|
|
## Priority 3: Connection pooling
|
||
|
|
Store reusable `reqwest::Client` in RpcHandler instead of creating per-request.
|
||
|
|
|
||
|
|
## Priority 4: Clippy
|
||
|
|
```bash
|
||
|
|
ssh archipelago@192.168.1.228 "cd ~/archy && cargo clippy --all-targets --all-features 2>&1"
|
||
|
|
```
|
||
|
|
|
||
|
|
## Priority 5: Replace println with tracing
|
||
|
|
`println!` → `tracing::info!`, `eprintln!` → `tracing::warn!`
|
||
|
|
|
||
|
|
## Verify
|
||
|
|
Zero clippy warnings, zero unwrap/expect in prod code, zero println.
|