return prune data when context canceled#33979
Conversation
00888cf to
47c13aa
Compare
daemon/prune.go
Outdated
There was a problem hiding this comment.
This one can stay as before as nothing was altered yet.
There was a problem hiding this comment.
Oh, thanks. Updated now.
d842e14 to
5b54eb3
Compare
daemon/prune.go
Outdated
There was a problem hiding this comment.
Do we need this new error?
Why not if err == context.Cancelled?
There was a problem hiding this comment.
This could also check context.DeadlineExceeded
There was a problem hiding this comment.
Thanks for your feedback. @cpuguy83
Currently I have updated the PR and only checked err == context.Cancelled. And if we also check context.DeadlineExceeded, what should we return, a report with nil, or a report with error?
daemon/prune.go
Outdated
There was a problem hiding this comment.
I don't think think we need to add this new error here, but in any case the wording is a bit funky.
Maybe the prune operation was cancelled
daemon/prune.go
Outdated
There was a problem hiding this comment.
I don't think it's right to return a cancelled error here since cancellation is just one reason why the context would be done.
daemon/prune.go
Outdated
There was a problem hiding this comment.
This sentence doesn't look complete.
daemon/prune.go
Outdated
There was a problem hiding this comment.
This sentence doesn't look complete.
daemon/prune.go
Outdated
There was a problem hiding this comment.
This sentence doesn't look complete.
c69a42b to
6f12a2b
Compare
builder/fscache/fscache.go
Outdated
There was a problem hiding this comment.
I see others are warnings as well...
daemon/prune.go
Outdated
There was a problem hiding this comment.
This is obvious from the return line, I don't think we need the comment explaining
daemon/prune.go
Outdated
There was a problem hiding this comment.
This is obvious from the return line, I don't think we need the comment explaining
4431087 to
88a3eeb
Compare
|
Thanks for your review again. @cpuguy83 |
thaJeztah
left a comment
There was a problem hiding this comment.
Left some questions / comments, thanks!
daemon/prune.go
Outdated
There was a problem hiding this comment.
this is now returning a different error than before, because the err = daemon.traverseLocalVolumes() is now moved inside the if ...
daemon/prune.go
Outdated
There was a problem hiding this comment.
related to my comment two lines below; this doesn't return if err == nil, correct?
There was a problem hiding this comment.
What you mentioned is right, I have updated this, Thanks a lot. @thaJeztah
PTAL
daemon/prune.go
Outdated
There was a problem hiding this comment.
nit; "when" should probably be "if"
would it be enough to just mention "return true to stop network traverse"? or is "context cancelled" a special case?
daemon/prune.go
Outdated
There was a problem hiding this comment.
I see @cpuguy83 suggested "debug"; just wondering if changing from "warn" in the current code to "debug" is too big a change, and if "info" would be a better fit.
Not a show stopper, just thinking aloud
There was a problem hiding this comment.
I think debug is fine. Not sure if that message being in the log by default has any benefits
Signed-off-by: allencloud <allen.sun@daocloud.io>
88a3eeb to
87b4dc2
Compare
|
hm, flaky? https://jenkins.dockerproject.org/job/Docker-PRs/44175/console |
|
Great to see all green. ☀️ 😄 |
Signed-off-by: allencloud allen.sun@daocloud.io
This PR takes into user's cancel request when prune data into consideration. When context is canceled, docker daemon still returns the data which is already pruned.
Prune Object includes: container, network, image, volume, and build cache.
fixes #33957
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)
/cc @mlaventure