Conversation
cleanup removed every service and every target one request at a time and only then deleted the balancer, so a balancer with 3 ports and 10 targets cost 14 API calls instead of 1. That matters when the project is close to the hourly rate limit. The API reference only says "Deletes a Load Balancer" and does not describe what happens to its services and targets. The change follows how Hetzner's own cloud controller manager and CLI delete a balancer: one delete call, with no prior removal of services or targets and no network detach. Network handling is left as it was. A failure part-way no longer leaves a balancer with some services already removed. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
This was referenced Sep 29, 2026
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.
cleanupnow deletes a load balancer with one API call instead of removing every service and target first. A balancer with 3 ports and 10 targets used to cost 14 calls, which hurts when the project is close to the 3600 requests/hour limit. The lookup is untouched: recorded ID first, then the name.The Hetzner API reference only says "Deletes a Load Balancer" for this endpoint and doesn't say what happens to the services and targets. I based the change on how Hetzner's own clients delete a balancer. They send one delete and remove nothing first:
LBClient.Delete.hcloud load-balancer deletedoes the same.I did not test this against a live project.
Network handling stays as it was:
cleanupdoesn't detach the balancer from its network, and neither of those clients does.One side effect: an error in the middle of the old loop left a balancer with some services already removed. That can't happen now.
The loops also carried the only log lines inside
cleanup, so the delete itself is no longer logged there with the balancer name and ID. A singletracing::info!before the delete would bring that back; I left it out to keep the change minimal.There is no unit test for the call itself, since the HTTP path has no mock in this repo. Existing tests and
cargo fmtpass, and clippy reports the same warnings as the base.Stacked on #47, so it targets
fix/release-balancer.Closes #44