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