Add more flexibility when fetching production value
This commit is contained in:
@ -71,7 +71,11 @@ pub async fn get_curr_consumption() -> anyhow::Result<EnergyConsumption> {
|
||||
let response = match curl {
|
||||
false => reqwest::get(url).await?.json::<FroniusResponse>().await?,
|
||||
true => {
|
||||
let res = std::process::Command::new("curl").arg(url).output()?;
|
||||
let res = std::process::Command::new("curl")
|
||||
.arg("--connect-timeout")
|
||||
.arg("1.5")
|
||||
.arg(url)
|
||||
.output()?;
|
||||
|
||||
if !res.status.success() {
|
||||
return Err(ConsumptionError::CurlReqFailed.into());
|
||||
|
Reference in New Issue
Block a user