Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Cleanup files.PublishedStorage after dropping a publish #1381
base: master
Are you sure you want to change the base?
Cleanup files.PublishedStorage after dropping a publish #1381
Changes from all commits
0c9fe00
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
please log the error. we canna see if we have werid permissions like 000 or other behavior.
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.
Okay, log.Printf will suffice? Or should I bring "github.com/rs/zerolog/log" which is used in other files there?
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.
in line 117 progress.Printf is used in RemoveDirs. I think we should follow that pattern... or return an fmt.Errorf as in line 160. what do you think ?
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.
and what should be done then? It's not the error, that needs any further handling.
Implemented it via progress.Printf as you proposed.
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.
on a (misconfigured) remote file server, there might be permission issues when removing directories. such errors should be logged... this is why I would still like to have a check for emptyness, bcs then we do not get an error.
do we have a check where a directory is not removed bcs not empty ?
another little thing: progress logs in aptly do not have punctiations, could you make the log similar to the others ?
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.
Oh, too much moving parts here..
but strings printed by aptly.Progress are seen only during cli operation
In api mode all logging is handled by gin or zerolog, I do not know for sure, but plain fmt.Println from gin controller in aptly outputs nothing to stdout.
Your intentions regarding localStorage.CleanupPublishTree() "errors" as you call them is not clear.
Imagine, we will return an error object from it, handle it in
func (collection *PublishedRepoCollection) Remove()
likeBut is that really an error of a scale, that we should terminate the whole process and to not update database at this point?!
Keep in mind, that by the time localStorage.CleanupPublishTree() is executed, all files concerned the publish being
Remove()
-ed are long ago gone. So, if we terminate the execution of Remove() at this point, we'll find ourselves in an inconsistent state!To my understanding, silently leaving directories intact if we can not remove them is the best bet in this situation.
Okay, we'll log this in cli via
progress
, but how about api mode?Also, as I mentioned earlier, I was unable log anything to console by plain printf from gin controller.