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

buiding a new body for conflict reponses #1068

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

javanlacerda
Copy link
Contributor

Closes #900

Summary

It adds retries updating the body for Rekor writing requests when the response has 409 code. It means that the body has conflict, then we should create a new/different body for the request.

Release Note

Documentation

return fmt.Errorf("rekor entry: %w", err)
resp, t, err := makeRekorRequest(cert, priv, hostPath)
// A new body should be created when it is conflicted
for resp.StatusCode == http.StatusConflict {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does it make sense it be in a while? Or should I set a number of attempts ?

Signed-off-by: Javan lacerda <[email protected]>
}
defer resp.Body.Close()
}
latency := time.Since(t).Milliseconds()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we record latency and response data for each request to Rekor? This would measure the total time for all requests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean we should also record the responses that has StatusConflict?

if err != nil {
return fmt.Errorf("error adding entry: %w", err)
}
defer resp.Body.Close()
// A new body should be created when it is conflicted
for {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we put a reasonable limit, let's say 10, on this loop?

t := time.Now()
resp, err := retryableClient.Do(req)
latency := time.Since(t).Milliseconds()
resp, t, err := makeRekorRequest(cert, priv, hostPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this into the for loop?


t = time.Now()
resp, err := retryableClient.Do(req)
return resp, t, err
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest returning the latency calculation latency := time.Since(t).Milliseconds() rather than the time object.

Signed-off-by: Javan lacerda <[email protected]>
Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

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

Thanks!

@haydentherapper haydentherapper merged commit d943cc2 into sigstore:main Apr 25, 2024
26 checks passed
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.

Prober retry logic can trigger failure for Rekor requests
2 participants