Skip to content

Commit

Permalink
"fix" upload count not tracking right
Browse files Browse the repository at this point in the history
  • Loading branch information
Flemmli97 committed Jan 22, 2024
1 parent fd53289 commit 51de925
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/src/upload_file_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub enum UploadFileAction<T> {
Cancelling,
UploadFiles(Vec<PathBuf>),
Uploading((String, String, String)),
Finishing,
Finishing(PathBuf, bool),
Finished(T),
Error,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,12 @@ async fn handle_upload_progress(
percentage_number as usize
)
}
// ConstellationProgressStream only ends (atm) when all files in the queue are done uploading
// This causes pending file count to not be updated which is way we send a message here too
if current_percentage == 100 {
let _ = tx_upload_file
.send(UploadFileAction::Finishing(file_path.clone(), false));
}
}
}
Progression::ProgressComplete { name, total } => {
Expand Down Expand Up @@ -589,7 +595,7 @@ async fn handle_upload_progress(
}
};
}
let _ = tx_upload_file.send(UploadFileAction::Finishing);
let _ = tx_upload_file.send(UploadFileAction::Finishing(file_path, true));
log::info!("{:?} file uploaded!", filename);
}

Expand Down
8 changes: 5 additions & 3 deletions ui/src/layouts/storage/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,12 @@ pub fn start_upload_file_listener(
upload_progress_bar::change_progress_percentage(&window, progress.clone());
upload_progress_bar::change_progress_description(&window, msg);
}
UploadFileAction::Finishing => {
UploadFileAction::Finishing(file, finish) => {
*files_been_uploaded.write_silent() = true;
if !files_in_queue_to_upload.read().is_empty() {
files_in_queue_to_upload.with_mut(|i| i.remove(0));
if !files_in_queue_to_upload.read().is_empty()
&& (finish || files_in_queue_to_upload.read().len() > 1)
{
files_in_queue_to_upload.with_mut(|i| i.retain(|p| !p.eq(&file)));
upload_progress_bar::update_files_queue_len(
&window,
files_in_queue_to_upload.read().len(),
Expand Down

0 comments on commit 51de925

Please sign in to comment.