Skip to content

Commit 4aa82af

Browse files
authored
Slight change to retry policy logging (Azure#19224)
1 parent eb78c5e commit 4aa82af

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sdk/azcore/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* Don't retry a request if the `Retry-After` delay is greater than the configured `RetryOptions.MaxRetryDelay`.
1111

1212
### Other Changes
13+
* Removed logging URL from retry policy as it's redundant.
14+
* Retry policy logs when it exits due to a non-retriable status code.
1315

1416
## 1.1.3 (2022-09-01)
1517

sdk/azcore/runtime/policy_retry.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (p *retryPolicy) Do(req *policy.Request) (resp *http.Response, err error) {
107107
try := int32(1)
108108
for {
109109
resp = nil // reset
110-
log.Writef(log.EventRetryPolicy, "\n=====> Try=%d %s %s", try, req.Raw().Method, req.Raw().URL.String())
110+
log.Writef(log.EventRetryPolicy, "=====> Try=%d", try)
111111

112112
// For each try, seek to the beginning of the Body stream. We do this even for the 1st try because
113113
// the stream may not be at offset 0 when we first get it and we want the same behavior for the
@@ -146,6 +146,7 @@ func (p *retryPolicy) Do(req *policy.Request) (resp *http.Response, err error) {
146146

147147
if err == nil && !HasStatusCode(resp, options.StatusCodes...) {
148148
// if there is no error and the response code isn't in the list of retry codes then we're done.
149+
log.Write(log.EventRetryPolicy, "exit due to non-retriable status code")
149150
return
150151
} else if ctxErr := req.Raw().Context().Err(); ctxErr != nil {
151152
// don't retry if the parent context has been cancelled or its deadline exceeded

0 commit comments

Comments
 (0)