feat(upload): add progressTotal to event payload (#2033)

Co-authored-by: Fabian-Lars <github@fabianlars.de>
This commit is contained in:
sid
2024-11-11 20:54:59 +04:00
committed by GitHub
parent 3e15acea9a
commit 5dadd205f5
4 changed files with 17 additions and 4 deletions
+3
View File
@@ -61,6 +61,7 @@ impl Serialize for Error {
#[serde(rename_all = "camelCase")]
struct ProgressPayload {
progress: u64,
progress_total: u64,
total: u64,
transfer_speed: u64,
}
@@ -99,6 +100,7 @@ async fn download(
stats.record_chunk_transfer(chunk.len());
let _ = on_progress.send(ProgressPayload {
progress: chunk.len() as u64,
progress_total: stats.total_transferred,
total,
transfer_speed: stats.transfer_speed,
});
@@ -153,6 +155,7 @@ fn file_to_body(channel: Channel<ProgressPayload>, file: File) -> reqwest::Body
stats.record_chunk_transfer(progress as usize);
let _ = channel.send(ProgressPayload {
progress,
progress_total: stats.total_transferred,
total,
transfer_speed: stats.transfer_speed,
});