-
Notifications
You must be signed in to change notification settings - Fork 23
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-1513]: Fix/loop-when-delete-files #442
Conversation
run(contentId: File['contentsId'], folderContentId: Folder['uuid']): boolean { | ||
const file = this.repository.searchByPartial({ contentsId: contentId }); | ||
const folder = this.folderFinder.findFromId(file?.folderId); | ||
const [_, folderUuid] = folder.placeholderId.split(':'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
folder has the UUID stored, so you can simply do folder.uuid
|
||
run(contentId: File['contentsId'], folderContentId: Folder['uuid']): boolean { | ||
const file = this.repository.searchByPartial({ contentsId: contentId }); | ||
const folder = this.folderFinder.findFromId(file?.folderId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid having findFromId with the id optional. If there is no ID we already know that it will fail to find it. So I would add a guard clause, this way if the file is not found, then the error thrown is from the file not being in the repo and not that a folder
} | ||
|
||
private async executeFn(item: string) { | ||
this.queue.delete(item); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be the other way around, first execute the function and delete it from the queue? I'm worried that if the deletion takes too long it can allow to delete files that does not need to be deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work, I only have a few nitpicks
8e2b062
to
e5d858a
Compare
Quality Gate passedIssues Measures |
Context:
Update: