loopd: consult waits one hundred and eighty seconds
Co-Authored-By: ornith-1.5-35b-a3b <agent@wntrmute.dev>
This commit is contained in:
@@ -26,6 +26,9 @@ pub const MAX_PENDING_WAIT: Duration = Duration::from_secs(24 * 60 * 60);
|
||||
/// longer: `brokerd` waits 170 s for `memoryd`, whose Honcho chats have 150 s (M5c spec,
|
||||
/// section 9).
|
||||
pub const ASK_MEMORY_WAIT: Duration = Duration::from_secs(180);
|
||||
/// The longest `BrokerPort` waits for a `consult` answer, unless `[broker] timeout_ms` is
|
||||
/// longer: `brokerd`'s `[consult] timeout_ms` defaults to 180 s (M6 spec, section 4.3).
|
||||
pub const CONSULT_WAIT: Duration = Duration::from_secs(180);
|
||||
/// The runbook entry every outage line ends with.
|
||||
pub const POINTER: &str = "see docs/runbook.md#broker-unavailable";
|
||||
|
||||
@@ -63,6 +66,7 @@ pub struct BrokerPort {
|
||||
socket: PathBuf,
|
||||
timeout: Duration,
|
||||
ask_timeout: Duration,
|
||||
consult_timeout: Duration,
|
||||
pending_cap: Duration,
|
||||
log: Box<dyn Fn(&str) + Send + Sync>,
|
||||
}
|
||||
@@ -73,6 +77,7 @@ impl BrokerPort {
|
||||
socket,
|
||||
timeout,
|
||||
ask_timeout: ASK_MEMORY_WAIT,
|
||||
consult_timeout: CONSULT_WAIT,
|
||||
pending_cap: MAX_PENDING_WAIT,
|
||||
log: Box::new(|l| eprintln!("{l}")),
|
||||
}
|
||||
@@ -88,10 +93,12 @@ impl BrokerPort {
|
||||
}
|
||||
|
||||
/// The wait for one call of `tool`, used wherever the port waits for that call: the timeout,
|
||||
/// or for `ask_memory` the longer of the timeout and its own wait.
|
||||
/// or for `ask_memory` and `consult` the longer of the timeout and that tool's own wait.
|
||||
pub fn timeout_for(&self, tool: &str) -> Duration {
|
||||
if tool == crate::memory::ASK_MEMORY {
|
||||
self.timeout.max(self.ask_timeout)
|
||||
} else if tool == crate::consult::CONSULT {
|
||||
self.timeout.max(self.consult_timeout)
|
||||
} else {
|
||||
self.timeout
|
||||
}
|
||||
@@ -114,6 +121,7 @@ impl BrokerPort {
|
||||
socket,
|
||||
timeout,
|
||||
ask_timeout: ASK_MEMORY_WAIT,
|
||||
consult_timeout: CONSULT_WAIT,
|
||||
pending_cap: MAX_PENDING_WAIT,
|
||||
log,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user