MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / shouldRetryTaskRelay

Function shouldRetryTaskRelay

controller/relay.go:441–478  ·  view source on GitHub ↗
(c *gin.Context, channelId int, taskErr *dto.TaskError, retryTimes int)

Source from the content-addressed store, hash-verified

439}
440
441func shouldRetryTaskRelay(c *gin.Context, channelId int, taskErr *dto.TaskError, retryTimes int) bool {
442 if taskErr == nil {
443 return false
444 }
445 if retryTimes <= 0 {
446 return false
447 }
448 if _, ok := c.Get("specific_channel_id"); ok {
449 return false
450 }
451 if taskErr.StatusCode == http.StatusTooManyRequests {
452 return true
453 }
454 if taskErr.StatusCode == 307 {
455 return true
456 }
457 if taskErr.StatusCode/100 == 5 {
458 // 超时不重试
459 if taskErr.StatusCode == 504 || taskErr.StatusCode == 524 {
460 return false
461 }
462 return true
463 }
464 if taskErr.StatusCode == http.StatusBadRequest {
465 return false
466 }
467 if taskErr.StatusCode == 408 {
468 // azure处理超时不重试
469 return false
470 }
471 if taskErr.LocalError {
472 return false
473 }
474 if taskErr.StatusCode/100 == 2 {
475 return false
476 }
477 return true
478}

Callers 1

RelayTaskFunction · 0.85

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected