feat(http): improve performance (#558)

feat/window/dnd-position
Lucas Fernandes Nogueira 2 years ago committed by GitHub
parent 12adc1dbec
commit aec17a90fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,5 @@
---
"http": patch
---
Improve response performance by using the new IPC streaming data.

@ -163,16 +163,15 @@ pub async fn fetch_send<R: Runtime>(
}) })
} }
// TODO: change return value to tauri::ipc::Response on next alpha
#[command] #[command]
pub(crate) async fn fetch_read_body<R: Runtime>( pub(crate) async fn fetch_read_body<R: Runtime>(
app: AppHandle<R>, app: AppHandle<R>,
rid: RequestId, rid: RequestId,
) -> crate::Result<Vec<u8>> { ) -> crate::Result<tauri::ipc::Response> {
let mut response_table = app.http().responses.lock().await; let mut response_table = app.http().responses.lock().await;
let res = response_table let res = response_table
.remove(&rid) .remove(&rid)
.ok_or(Error::InvalidRequestId(rid))?; .ok_or(Error::InvalidRequestId(rid))?;
Ok(res.bytes().await?.to_vec()) Ok(tauri::ipc::Response::new(res.bytes().await?.to_vec()))
} }

Loading…
Cancel
Save