forget: report count of deleted files correctly#5179
Conversation
Hey @MichaelEischer, I want to remove the dependence on This will allow restic internal methods to be tested independently of the progress reporting. |
086aa5b to
75849f5
Compare
2b992c3 to
14de45b
Compare
MichaelEischer
left a comment
There was a problem hiding this comment.
The removal of the bar.SetMax call is a significant regression and not necessary as mentioned in the below comments.
I want to remove the dependence on
*progress.Counterfrom here, I believe the report function can update the bar as well since it's a dependency injected from outside.This will allow restic internal methods to be tested independently of the progress reporting.
I don't understand the testing argument. In fact the test case no longer tests the behavior of ParallelRemove but rather of ParallelRemove + custom progress bar calls in report function. For consistent behavior, it feels more reasonable to have progress bar updates handled by ParallelRemove. I don't see a technical reason why that wouldn't work.
I was thinking that the reporting and progress counters must be together. I can revert the change to the fix I had made earlier. Thanks for the review. I will think about this more before making any major changes. |
14de45b to
5e64578
Compare
…orb the error * sometimes, the report function may absorb the error and return nil, in those cases the bar.Add(1) method would execute even if the file deletion had failed
5e64578 to
58f58a9
Compare
Yes, please revert the changes from 94ad25e . The implementation from 5e64578 is what I had in mind. The added tests should still work with minor modifications. I don't think it's worth the trouble to introduce other abstractions, let's just keep using the progress counter. |
I have made the modifications, let me know if I have missed something. |
MichaelEischer
left a comment
There was a problem hiding this comment.
LGTM. Thanks!
Have you seen #5140 (comment) ? Do you want to address that in this PR or should we consider this a separate issue?
|
We can address the concerns on a separate PR after discussion. |
What does this PR change? What problem does it solve?
ParallelRemovefunction. This will allow the function to be independently tested of the progress reporting logic.ParallelRemovefunction. I have made the corresponding changes in the other locations.Was the change previously discussed in an issue or on the forum?
Closes #5140
Checklist
changelog/unreleased/that describes the changes for our users (see template).