fix(arr): re-read the command timeout every batch
This commit is contained in:
@@ -237,4 +237,36 @@ async fn a_hanging_command_is_killed_at_the_timeout() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Issue #219: the timeout is not frozen at construction. The settings API
|
||||
/// stores the row's value into [`Command::timeout_cell`] on every edit, and
|
||||
/// the next batch must already run under it.
|
||||
#[tokio::test]
|
||||
async fn an_edited_timeout_reaches_the_next_call() {
|
||||
let dir = tempfile::tempdir().expect("tempdir");
|
||||
let script = stub(dir.path(), "hang.sh", "sleep 30\n");
|
||||
let backend =
|
||||
Command::new(config(&script.display().to_string(), DEFAULT)).expect("backend constructs");
|
||||
|
||||
// The edit that a PUT of remote_command_timeout_seconds performs.
|
||||
backend
|
||||
.timeout_cell()
|
||||
.store(150, std::sync::atomic::Ordering::Relaxed);
|
||||
|
||||
let error = translate(
|
||||
&backend,
|
||||
&cues(&["hello"]),
|
||||
&Language::Other("en".to_owned()),
|
||||
&Language::PortuguesePortugal,
|
||||
)
|
||||
.await
|
||||
.expect_err("the edited timeout must apply without a restart");
|
||||
|
||||
match error {
|
||||
Error::Transport { source, .. } => {
|
||||
assert!(source.to_string().contains("150ms"), "{source}");
|
||||
}
|
||||
other => panic!("expected Transport, got {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
const DEFAULT: Duration = arr_subs::COMMAND_DEFAULT_TIMEOUT;
|
||||
|
||||
Reference in New Issue
Block a user