Stream async job warnings as they arrive for delete commands - #3859
Open
johha wants to merge 1 commit into
Open
Conversation
Migrate delete, delete-org, and delete-space from aggregated PollJob to a streaming job poll (PollJobToEventStream -> WaitForResult), so warnings print live instead of dumped at the end. Dedupe distinct warnings to at most once per operation.
Contributor
Author
|
Backport for v8: #3860 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of the Change
cf delete,cf delete-org, andcf delete-spacekick off an asynchronous Cloud Controller job and then poll it to completion. Previously the CLI aggregated every warning returned across all poll ticks and dumped them at the very end, after the job reached a terminal state. Because Cloud Controller re-sends the same warnings on every poll, a single warning could be printed dozens of times.This PR migrates those three commands from the aggregated
CloudControllerClient.PollJobpath to a streaming poll: the actor returns achan PollJobEvent(viaPollJobToEventStream) thatcommand/v7/shared.WaitForResultdrains, printing warnings as they arrive instead of at the end.Key changes:
DeleteApplicationByNameAndSpace,DeleteOrganization, andDeleteSpacenow return(chan PollJobEvent, Warnings, error). Forcf delete -r, the app-delete job and each route-delete job are merged into a single stream in the actor, so the whole operation streams through one channel.WaitForResultprints each distinct warning at most once per operation, collapsing the tick-by-tick repeats (including warnings that interleave across ticks).Example:
cf delete-orgagainst a job that returns warnings on every pollBefore (warnings aggregated and repeated per poll tick):
After (each distinct warning shown once, streamed live with progress dots):
cf delete APP -r(delete app + mapped routes) andcf delete-spacebehave the same way - warnings from the app job and each route/space job stream through as the jobs progress.Why Is This PR Valuable?
Users deleting orgs, spaces, or apps get feedback while the operation runs rather than a wall of duplicated text at the end. Warnings that Cloud Controller emits mid-operation (progress hints, content warnings) now surface promptly and legibly - each distinct message once - instead of being buffered until the job finishes or the poll window times out.
This is part of the ongoing effort to make recursive/async delete operations more intuitive (cloudfoundry/cloud_controller_ng#3589). The corresponding Cloud Controller work that emits these async-delete warnings is landing on the server side; this PR is the CLI half that surfaces them well.
Applicable Issues
How Urgent Is The Change?
Not urgent
Other Relevant Parties
None.
This PR was drafted with the help of Claude (Opus).