Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PB-3237] feat/add folder creation queue #1419

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rafijv
Copy link
Contributor

@rafijv rafijv commented Jan 14, 2025

Description

Added a folder creation queue that creates folders in parallel to the files, so file uploads are not stuck waiting for folder creations

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

How Has This Been Tested?

Additional Notes

@rafijv rafijv self-assigned this Jan 14, 2025
@rafijv rafijv requested a review from CandelR as a code owner January 14, 2025 12:23
Copy link

vercel bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drive-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 3:25pm

Copy link
Member

@sg-gs sg-gs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the stats that show an improvement over the current implementation to the description?

folderQueue.drain(checkCompletion);
filesQueue.drain(checkCompletion);

levels.forEach(async (level) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why async without await? forEach is sequential, so unless you are planning to do a Promise.all or something like that, this is not needed

Copy link
Contributor Author

@rafijv rafijv Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I have already removed it.
Regarding the stats I have put a comment in jira
https://inxt.atlassian.net/browse/PB-3236?focusedCommentId=32663

Copy link

cloudflare-workers-and-pages bot commented Jan 15, 2025

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9a6c360
Status:⚡️  Build in progress...

View logs

@@ -959,9 +959,7 @@ const uploadItems = async (props: DriveExplorerProps, rootList: IRoot[], files:
onSuccess: onDragAndDropEnd,
},
}));
dispatch(storageThunks.uploadMultipleFolderThunkNoCheck(folderDataToUpload)).then(() => {
dispatch(fetchSortedFolderContentThunk(currentFolderId));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this no longer necessary for the folder to be displayed in order?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is needed but I had to move it inside uploadMultipleFolderThunkNoCheck

.unwrap()
.then(() => {
alreadyUploaded += level.files.length;
alreadyUploaded += 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this +1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I have not made any changes, it is used to calculate the progress of uploaded files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the code didn't change in that part, we can take advantage of the task and refactor this line with alreadyUploaded += level.files.length + 1; to keep the code cleaner

}
};

const checkCompletion = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this function need to be async?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not now, I remove it, thanks!

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Contributor

@CandelR CandelR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take advantage of the task and add tests to this functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants