@@ -181,25 +181,25 @@ func NewRetryPolicyFactory(o RetryOptions) pipeline.Factory {
181
181
}
182
182
183
183
// Set the server-side timeout query parameter "timeout=[seconds]"
184
- timeout := int32 ( o .TryTimeout . Seconds ()) // Max seconds per try
185
- if deadline , ok := ctx .Deadline (); ok { // If user's ctx has a deadline, make the timeout the smaller of the two
186
- t := int32 ( deadline .Sub (time .Now ()). Seconds ()) // Duration from now until user's ctx reaches its deadline
187
- logf ("MaxTryTimeout=%d secs, TimeTilDeadline=%d sec\n " , timeout , t )
184
+ timeout := o .TryTimeout // Max time per try
185
+ if deadline , ok := ctx .Deadline (); ok { // If user's ctx has a deadline, make the timeout the smaller of the two
186
+ t := deadline .Sub (time .Now ()) // Duration from now until user's ctx reaches its deadline
187
+ logf ("MaxTryTimeout=%d secs, TimeTilDeadline=%d sec\n " , int32 ( timeout . Seconds ()), int32 ( t . Seconds ()) )
188
188
if t < timeout {
189
189
timeout = t
190
190
}
191
191
if timeout < 0 {
192
192
timeout = 0 // If timeout ever goes negative, set it to zero; this happen while debugging
193
193
}
194
- logf ("TryTimeout adjusted to=%d sec\n " , timeout )
194
+ logf ("TryTimeout adjusted to=%d sec\n " , int32 ( timeout . Seconds ()) )
195
195
}
196
196
q := requestCopy .Request .URL .Query ()
197
- q .Set ("timeout" , strconv .Itoa (int (timeout + 1 ))) // Add 1 to "round up"
197
+ q .Set ("timeout" , strconv .Itoa (int (timeout . Seconds () + 1 ))) // Add 1 to "round up"
198
198
requestCopy .Request .URL .RawQuery = q .Encode ()
199
199
logf ("Url=%s\n " , requestCopy .Request .URL .String ())
200
200
201
201
// Set the time for this particular retry operation and then Do the operation.
202
- tryCtx , tryCancel := context .WithTimeout (ctx , time . Second * time . Duration ( timeout ) )
202
+ tryCtx , tryCancel := context .WithTimeout (ctx , timeout )
203
203
//requestCopy.Body = &deadlineExceededReadCloser{r: requestCopy.Request.Body}
204
204
response , err = next .Do (tryCtx , requestCopy ) // Make the request
205
205
/*err = improveDeadlineExceeded(err)
0 commit comments