struct ClientContext<'c,C> {
ic: &'c InstanceConfig,
+ effective_http_timeout: Duration,
hclient: &'c Arc<hyper::Client<C>>,
reporter: &'c parking_lot::Mutex<Reporter<'c>>,
}
{}
{}
{}
+ {}
{}"#),
&c.ic.link.client,
token,
c.ic.target_requests_outstanding,
show_timeout,
+ c.ic.max_batch_down,
);
let prefix2 = format!(into_crlfs!(
let resp = c.hclient.request(req);
let fut = Box::pin(async move {
- let r = async { tokio::time::timeout( c.ic.http_timeout, async {
+ let r = async { tokio::time::timeout( c.effective_http_timeout, async {
let resp = resp.await.context("make request")?;
let status = resp.status();
let resp = resp.into_body();
.context("HTTP error fetching response body")?;
if ! status.is_success() {
- // xxx get body and log it
throw!(anyhow!("HTTP error status={} body={:?}",
&status, String::from_utf8_lossy(&resp)));
}
reqs.push(fut);
}
-#[allow(unused_variables)] // xxx
-#[allow(unused_mut)] // xxx
-#[allow(dead_code)] // xxx
async fn run_client<C:HCC>(
ic: InstanceConfig,
hclient: Arc<hyper::Client<C>>
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")
(reqs.len() < ic.target_requests_outstanding.sat() ||
(reqs.len() < ic.max_requests_outstanding.sat() &&
! upbound.is_empty()))
- // xxx backpressure, if too much in rx_queue
=>
{
submit_request(&c, &mut req_num, &mut reqs,