Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilianxr committed Jan 6, 2025
1 parent 2f74bb4 commit 00562d3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/server/src/controllers/workspaces/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,16 @@ pub async fn add_stream(
0
};

log::debug!(
"workspace::files::add_stream file has written bytes: {:?}",
bytes_written
);
// Log progress every 5MB
if bytes_written % (10 * 1024 * 1024) == 0 {
log::debug!(
"workspace::files::add_stream file upload progress: {:.1}% ({}/{} bytes)",
(bytes_written as f64 / total_size as f64) * 100.0,
bytes_written,
total_size
);
}

let mut buffer = web::BytesMut::new();

while let Some(chunk) = payload.next().await {
Expand All @@ -157,6 +163,8 @@ pub async fn add_stream(
if chunk.len() == 1 && chunk[0] == 0 {
// validate file size match
if bytes_written == total_size {
log::info!("add_stream upload completed: {} bytes", total_size);

files.push(filepath.clone());

let path = repositories::workspaces::files::add(&workspace, filepath)?;
Expand Down

0 comments on commit 00562d3

Please sign in to comment.