fix: address reviewer feedback — regex OnceLock and restore tick rate

- Compile whitespace regex once via OnceLock instead of on every
  non-success response; makes format_error_body infallible (String
  return, no Result) eliminating the only practical failure mode
- Revert default tick rate from 100ms back to 50ms to preserve the
  existing 20-second Servarr poll cadence (tick_until_poll=400 × 50ms);
  the recv() change is the real CPU fix — the tick rate change was
  unnecessary and silently halved the data refresh rate
- Keep MANAGARR_TICK_RATE_MS as opt-in override; note that tuning it
  proportionally stretches the poll interval alongside the tick rate
This commit is contained in:
Jonathan McCumber committed 2026-06-28 13:00:16 -05:00
1 parent 6c41e0704e
commit a72b2991fd
2 files changed
+12 -13

No files matched your search

+5 -8
View File
@@ -19,7 +19,7 @@ pub struct Events {
rx: Receiver<InputEvent<Key>>,
}
const DEFAULT_TICK_RATE_MS: u64 = 100;
const DEFAULT_TICK_RATE_MS: u64 = 50;
fn configured_tick_rate_ms_from(raw: Option<&str>) -> u64 {
raw
@@ -78,18 +78,15 @@ mod tests {
use super::*;
#[test]
fn defaults_to_a_slower_idle_tick_rate() {
assert_eq!(DEFAULT_TICK_RATE_MS, 100);
assert_eq!(configured_tick_rate_ms_from(None), 100);
fn defaults_to_original_tick_rate() {
assert_eq!(DEFAULT_TICK_RATE_MS, 50);
assert_eq!(configured_tick_rate_ms_from(None), 50);
}
#[test]
fn parses_positive_tick_rates_and_rejects_invalid_values() {
assert_eq!(configured_tick_rate_ms_from(Some("250")), 250);
assert_eq!(
configured_tick_rate_ms_from(Some("0")),
DEFAULT_TICK_RATE_MS
);
assert_eq!(configured_tick_rate_ms_from(Some("0")), DEFAULT_TICK_RATE_MS);
assert_eq!(
configured_tick_rate_ms_from(Some("abc")),
DEFAULT_TICK_RATE_MS