feat: support max retry times option for driver session

This commit is contained in:
lilong.129
2025-07-09 10:35:43 +08:00
parent eb2835626c
commit f334a2db8e
2 changed files with 8 additions and 2 deletions

View File

@@ -175,7 +175,13 @@ func (s *DriverSession) RequestWithRetry(method string, urlStr string, rawBody [
) {
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
rawResp, err = s.Request(method, urlStr, rawBody, opts...)
if err == nil {