Skip to content

Conversation

@danielthegray
Copy link

@danielthegray danielthegray commented Jan 9, 2026

This will allow the polling of asynchronous actions from the Hetzner API without consuming the main rate limit of the other (main) endpoints.

Testing

I tested the new method of the API client by integrating it in a small CLI app with my own API token and polling an action, and the response (and status) came back correctly.

I've also added a small unit test covering the "happy path" case of polling for a server_delete action, ensuring that all the fields are parsed + populated as expected.

@rkosegi
Copy link
Member

rkosegi commented Jan 9, 2026

Hi @danielthegray, thank you for contribution.

Unless I missed something, this method is not really needed to support polling since addition of 58969fa.
With that said, I'm not against this PR if you also add simple unit test for it.

@danielthegray
Copy link
Author

danielthegray commented Jan 9, 2026

Hi, interesting! OK! Have you been working on the actions polling for server success checking on your end?

I was thinking about the issue I saw in your queue (and wondered if it could help solve other issues like the race condition with the burst requests of servers), and I saw this API endpoint was missing and thought it was fairly trivial to add :) If this client is ever used for other projects it might be useful to have a separate endpoint. I was not aware of the actions under each resource type to query its actions.

The main nuisance that I can see in the /v1/servers/actions API is that it seems to put the oldest actions on page 1, and the newer ones on the higher pages, unless you explicitly add ?sort=started:desc in the call, which I don't see how to do with that wrapped API call. I'm guessing that it would be useful to just take the action returned from the server start/delete action and then just poll on that ID, as part of the "waiting" code (instead of polling the server ID), as somebody else was suggesting in the issue. What are your thoughts on that?

Anyway, this function is fairly general and could be used for other things, so I've added the unit test you requested, trying to stick as closely as possible to the style of the API in general. Please let me know if you would like me to make any adjustments, no matter how minor/trivial they might seem!

This will allow the polling of asynchronous actions from the Hetzner API
without consuming the main rate limit of the other (main) endpoints.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 9, 2026

Copy link
Member

@rkosegi rkosegi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rkosegi rkosegi merged commit 34a2213 into dNationCloud:main Jan 9, 2026
3 checks passed
@danielthegray danielthegray deleted the add-actions-api branch January 9, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants