Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 404 retry, add custom ctx with timeout #285

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions msgraph/application_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io"
"net/http"
"time"
manicminer marked this conversation as resolved.
Show resolved Hide resolved

"github.com/hashicorp/go-azure-sdk/sdk/odata"
)
Expand Down Expand Up @@ -94,10 +95,14 @@ func (c *ApplicationTemplatesClient) Instantiate(ctx context.Context, applicatio
return nil, status, fmt.Errorf("json.Marshal(): %v", err)
}

// This post call can often timeout and return a 404, particularly against US Gov cloud. The aim here is to give it longer to complete on azure's backend
// before timeout occurs
ctx, cancel := context.WithTimeout(ctx, 45*time.Second)
defer cancel()

manicminer marked this conversation as resolved.
Show resolved Hide resolved
resp, status, _, err := c.BaseClient.Post(ctx, PostHttpRequestInput{
Body: body,
ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc,
ValidStatusCodes: []int{http.StatusCreated},
Body: body,
ValidStatusCodes: []int{http.StatusCreated},
Uri: Uri{
Entity: fmt.Sprintf("/applicationTemplates/%s/instantiate", *applicationTemplate.ID),
},
Expand Down
Loading