Apply the remote-command timeout setting #219

Closed
opened 2026-08-25 02:21:39 +01:00 by naps62-yolo · 1 comment
Owner

DESIGN.md §15 says the daily budgets, the chosen engine and the per-provider
enables are "database rows edited from /settings without a restart".
remote_command_timeout_seconds is such a row (#198), and it never reaches
the backend that would use it.

CommandConfig.timeout is fixed when the backend is constructed at startup
(#216 passes arr_subs::COMMAND_DEFAULT_TIMEOUT), and there is no path from
the subtitle_settings row to a running backend instance. Editing the value
in /settings therefore does nothing until the daemon restarts — and after a
restart it still reads the constant, not the row.

Either read the setting per translation and apply it to the call, or rebuild
the affected backend when the row changes. The first is simpler and matches
how providers_enabled and translation_engine are already read per request
rather than cached at startup.

Found while implementing #216.

Depends on: #193, #198, #216

DESIGN.md §15 says the daily budgets, the chosen engine and the per-provider enables are "database rows edited from `/settings` without a restart". `remote_command_timeout_seconds` is such a row (#198), and it never reaches the backend that would use it. `CommandConfig.timeout` is fixed when the backend is constructed at startup (#216 passes `arr_subs::COMMAND_DEFAULT_TIMEOUT`), and there is no path from the `subtitle_settings` row to a running backend instance. Editing the value in `/settings` therefore does nothing until the daemon restarts — and after a restart it still reads the constant, not the row. Either read the setting per translation and apply it to the call, or rebuild the affected backend when the row changes. The first is simpler and matches how `providers_enabled` and `translation_engine` are already read per request rather than cached at startup. Found while implementing #216. Depends on: #193, #198, #216
naps62-yolo added this to the Subtitles milestone 2026-08-25 02:21:39 +01:00
naps62-yolo added the difficulty/easyarea/substype/bugphase/9-subtitles labels 2026-08-25 02:21:39 +01:00
Author
Owner

Implemented in subtitles/219-command-timeout, pushed to origin.

Command no longer freezes its timeout at construction: it keeps a shared Arc<AtomicU64> cell (milliseconds) that translate_inner re-reads per batch, exposed as Command::timeout_cell(). The daemon now builds the translation backends once at startup — previously translation_backends() ran twice, so the API and the reconcile lane each had their own Command instance — seeds the cell from the subtitle_settings row (new offline-cached query), and hands the cell to AppState; the PUT /api/settings/subtitles handler stores the row's value into it after writing, so an edit reaches both the manual translate path and the reconcile sweep without a restart.

just ci passed (exit 0; 679 tests, web-check clean).

Findings

  • The daemon's per-tick load_settings (crates/arr-daemon/src/subtitles.rs) still does not select remote_command_timeout_seconds. Nothing consumes it there now that the backend reads its own cell, but if a future tick-side rule needs it, the row shape and the API's SubtitleSettings have drifted apart on that column.
  • subtitle_action's doc comment still claims translation backends are "passed empty" pending bootstrap wiring (#216) — stale since #216 landed.
Implemented in `subtitles/219-command-timeout`, pushed to origin. `Command` no longer freezes its timeout at construction: it keeps a shared `Arc<AtomicU64>` cell (milliseconds) that `translate_inner` re-reads per batch, exposed as `Command::timeout_cell()`. The daemon now builds the translation backends once at startup — previously `translation_backends()` ran twice, so the API and the reconcile lane each had their own `Command` instance — seeds the cell from the `subtitle_settings` row (new offline-cached query), and hands the cell to `AppState`; the PUT `/api/settings/subtitles` handler stores the row's value into it after writing, so an edit reaches both the manual translate path and the reconcile sweep without a restart. `just ci` passed (exit 0; 679 tests, web-check clean). ## Findings - The daemon's per-tick `load_settings` (`crates/arr-daemon/src/subtitles.rs`) still does not select `remote_command_timeout_seconds`. Nothing consumes it there now that the backend reads its own cell, but if a future tick-side rule needs it, the row shape and the API's `SubtitleSettings` have drifted apart on that column. - `subtitle_action`'s doc comment still claims translation backends are "passed empty" pending bootstrap wiring (#216) — stale since #216 landed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yolo/arr#219