feat: automatically poll GET endpoint on 202 with exponential backoff#527
Open
praneetloke wants to merge 4 commits intomainfrom
Open
feat: automatically poll GET endpoint on 202 with exponential backoff#527praneetloke wants to merge 4 commits intomainfrom
praneetloke wants to merge 4 commits intomainfrom
Conversation
When a Create or Update request returns HTTP 202 (Accepted), the provider now polls the GET endpoint from the CRUD map until the resource is ready: - Polling continues only while GET returns 404 (resource not yet created), stopping when GET returns 200 (resource exists). - Uses exponential backoff starting at 1s, doubling each attempt, capped at 30s to avoid overwhelming the cloud provider API. - Timeout is taken from the CreateRequest/UpdateRequest.Timeout field (defaults to 10 minutes if unset). - For Create: the 202 response body is merged into inputs so that path params (e.g. resource ID) can be resolved for the GET URL. - For Update: oldState is used for path param resolution. Adds three test cases covering: - Create 202: happy path (404 x2, then 200) - Create 202: timeout when resource never becomes ready - Update 202: happy path (404 x1, then 200) Closes #262 Co-authored-by: Praneet Loke <praneetloke@users.noreply.github.com>
285b33b to
cbc3753
Compare
praneetloke
commented
Feb 24, 2026
|
|
||
| pollOutputs, pollErr := p.pollResourceUntilReady(ctx, *crudMap.R, inputs, pollTimeout) | ||
| if pollErr != nil { | ||
| return nil, errors.Wrap(pollErr, "polling resource after 202 response") |
Member
Author
There was a problem hiding this comment.
I think we should return the outputs we have from the initial POST request, since the resource was accepted but just not yet ready. The output should contain the resource ID from the server which can be used to refresh the state.
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.
Closes #262
Changes
When a Create or Update returns HTTP 202 (Accepted), the provider polls the GET endpoint:
Generated with Claude Code