mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 06:23:52 +08:00
feat: support max retry times option for driver session
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0-250708
|
v5.0.0-250709
|
||||||
|
|||||||
@@ -175,7 +175,13 @@ func (s *DriverSession) RequestWithRetry(method string, urlStr string, rawBody [
|
|||||||
) {
|
) {
|
||||||
var lastError error
|
var lastError error
|
||||||
|
|
||||||
for attempt := 1; attempt <= s.maxRetry; attempt++ {
|
maxRetry := s.maxRetry
|
||||||
|
options := option.NewActionOptions(opts...)
|
||||||
|
if options.MaxRetryTimes > 0 {
|
||||||
|
maxRetry = options.MaxRetryTimes
|
||||||
|
}
|
||||||
|
|
||||||
|
for attempt := 1; attempt <= maxRetry; attempt++ {
|
||||||
// Execute the request
|
// Execute the request
|
||||||
rawResp, err = s.Request(method, urlStr, rawBody, opts...)
|
rawResp, err = s.Request(method, urlStr, rawBody, opts...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user