pbs-client: avoid mut self in http_client methods.

It is not necessary, so avoid it. The client can now be used
with multiple threads (without using a Mutex).

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer
2021-12-04 14:11:55 +01:00
parent 7549114c9f
commit d4877712f8
8 changed files with 56 additions and 56 deletions

View File

@ -190,7 +190,7 @@ async fn call_api(
}
async fn call_api_http(method: &str, path: &str, params: Option<Value>) -> Result<Value, Error> {
let mut client = connect_to_localhost()?;
let client = connect_to_localhost()?;
let path = format!(
"api2/json/{}",
@ -260,8 +260,8 @@ async fn call_api_and_format_result(
if let Some(upid) = result.as_str() {
if PROXMOX_UPID_REGEX.is_match(upid) {
if use_http_client() {
let mut client = connect_to_localhost()?;
view_task_result(&mut client, json!({ "data": upid }), &output_format).await?;
let client = connect_to_localhost()?;
view_task_result(&client, json!({ "data": upid }), &output_format).await?;
return Ok(());
}