server: recover on slurp fetch failures
This commit is contained in:
parent
8a6b3ff501
commit
daeb8c88a1
@ -318,13 +318,16 @@ impl<'c> Transformer for SlurpContents<'c> {
|
|||||||
} else {
|
} else {
|
||||||
let resp = reqwest::get(link.as_str()).await?;
|
let resp = reqwest::get(link.as_str()).await?;
|
||||||
let status = resp.status();
|
let status = resp.status();
|
||||||
if status.is_server_error() || retryable_status.contains(&status) {
|
if status.is_server_error() {
|
||||||
return Err(TransformError::RetryableHttpStatusError(
|
error!("status error for {link}: {status}");
|
||||||
status,
|
return Ok(html.to_string());
|
||||||
link.to_string(),
|
}
|
||||||
));
|
if retryable_status.contains(&status) {
|
||||||
|
error!("retryable error for {link}: {status}");
|
||||||
|
return Ok(html.to_string());
|
||||||
}
|
}
|
||||||
if !status.is_success() {
|
if !status.is_success() {
|
||||||
|
error!("unsuccessful for {link}: {status}");
|
||||||
return Ok(html.to_string());
|
return Ok(html.to_string());
|
||||||
}
|
}
|
||||||
let body = resp.text().await?;
|
let body = resp.text().await?;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user