feat: better error output if request for xmrig fail

This commit is contained in:
Cyrix126 2024-03-26 16:33:45 +01:00
parent 307a8b5dba
commit e9d8d37ad2

View file

@ -617,17 +617,18 @@ impl Helper {
);
// Send an HTTP API request
debug!("XMRig Watchdog | Attempting HTTP API request...");
if let Ok(priv_api) =
PrivXmrigApi::request_xmrig_api(client.clone(), &api_uri, token).await
{
match PrivXmrigApi::request_xmrig_api(client.clone(), &api_uri, token).await {
Ok(priv_api) => {
debug!("XMRig Watchdog | HTTP API request OK, attempting [update_from_priv()]");
PubXmrigApi::update_from_priv(&pub_api, priv_api);
} else {
}
Err(err) => {
warn!(
"XMRig Watchdog | Could not send HTTP API request to: {}",
api_uri
"XMRig Watchdog | Could not send HTTP API request to: {}\n{}",
api_uri, err
);
}
}
// Sleep (only if 900ms hasn't passed)
let elapsed = now.elapsed().as_millis();
@ -811,7 +812,7 @@ impl PrivXmrigApi {
.uri(api_uri)
.body(hyper::Body::empty())?;
let response = tokio::time::timeout(
std::time::Duration::from_millis(500),
std::time::Duration::from_millis(5000),
client.request(request),
)
.await?;