for this long
On client: give up on any http request outstanding for
for this long plus http_timeout_grace
+ Warning messages about link problems, printed by the client,
+ are rate limited to no more than one per effective timeout.
Client's effective timeout must be at least server's (checked).
[30 s; LIMIT: 121s]
/// }
/// ```
#[proc_macro_derive(ResolveConfig, attributes(
- limited, server, client, special
+ limited, server, client, computed, special
))]
pub fn resolve(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = parse_macro_input!(input as DeriveInput);
struct ClientContext<'c,C> {
ic: &'c InstanceConfig,
- effective_http_timeout: Duration, // also min err report interval, xxx doc
hclient: &'c Arc<hyper::Client<C>>,
reporter: &'c parking_lot::Mutex<Reporter<'c>>,
}
let resp = c.hclient.request(req);
let fut = Box::pin(async move {
- let r = async { tokio::time::timeout( c.effective_http_timeout, async {
+ let r = async { tokio::time::timeout( c.ic.effective_http_timeout, async {
let resp = resp.await.context("make request")?;
let status = resp.status();
let resp = resp.into_body();
reporter: &reporter,
hclient: &hclient,
ic: &ic,
- effective_http_timeout: ic.http_timeout.checked_add(ic.http_timeout_grace)
- .ok_or_else(|| anyhow!("calculate effective http timeout ({:?} + {:?})",
- ic.http_timeout, ic.http_timeout_grace))?,
};
let mut ipif = tokio::process::Command::new("sh")
}
},
- _ = tokio::time::sleep(c.effective_http_timeout),
+ _ = tokio::time::sleep(c.ic.effective_http_timeout),
if rx_queue_space.is_err() =>
{
reporter.lock().filter(None, Err::<Void,_>(
#[client] pub http_retry: Duration,
#[client] pub url: Uri,
#[client] pub vroutes: Vec<IpNet>,
+
+ // Computed, rather than looked up. Client only:
+ #[computed] pub effective_http_timeout: Duration,
}
static DEFAULT_CONFIG: &str = r#"
}
}
+ #[throws(AE)]
+ pub fn computed<T>(&self, _key: &'static str) -> T
+ where T: Default
+ {
+ default()
+ }
+
#[throws(AE)]
pub fn special_ipif(&self, key: &'static str) -> String {
match self.end {
.parse().unwrap()
}
+ self.effective_http_timeout = {
+ let a = self.http_timeout;
+ let b = self.http_timeout_grace;
+ a.checked_add(b).ok_or_else(
+ || anyhow!("calculate effective http timeout ({:?} + {:?})", a, b)
+ )?
+ };
+
check_batch(self.max_batch_up, "max_batch_up")?;
},