-
Notifications
You must be signed in to change notification settings - Fork 58
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
buiding a new body for conflict reponses #1068
Conversation
Signed-off-by: Javan lacerda <[email protected]>
cmd/prober/write.go
Outdated
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 { |
There was a problem hiding this comment.
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]>
cmd/prober/write.go
Outdated
} | ||
defer resp.Body.Close() | ||
} | ||
latency := time.Since(t).Milliseconds() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
cmd/prober/write.go
Outdated
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 { |
There was a problem hiding this comment.
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?
cmd/prober/write.go
Outdated
t := time.Now() | ||
resp, err := retryableClient.Do(req) | ||
latency := time.Since(t).Milliseconds() | ||
resp, t, err := makeRekorRequest(cert, priv, hostPath) |
There was a problem hiding this comment.
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?
cmd/prober/write.go
Outdated
|
||
t = time.Now() | ||
resp, err := retryableClient.Do(req) | ||
return resp, t, err |
There was a problem hiding this comment.
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]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
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