fix(video): 异步任务 - 完善全局轮询容错与调度策略

This commit is contained in:
hzw committed 2026-09-12 21:28:41 +08:00
1 parent d2efd81b8e
commit 7c074e5291
14 files changed
+462 -41

No files matched your search

+10 -2
View File
@@ -664,10 +664,18 @@ func (s *Service) LogAPICall(log model.ApiCallLog) error {
var nextPollAt *time.Time
if stage == "create" && log.Status == model.ApiCallStatusSucceeded && log.ProviderRequestID != "" {
stage = "accepted"
next := time.Now().Add(2 * time.Second)
delay := 2 * time.Second
if log.Capability == "video" {
delay = defaultVideoPollInterval
}
next := time.Now().Add(delay)
nextPollAt = &next
} else if stage == "poll" {
next := time.Now().Add(5 * time.Second)
delay := 5 * time.Second
if log.Capability == "video" {
delay = defaultVideoPollInterval
}
next := time.Now().Add(delay)
nextPollAt = &next
}
if err := s.repo.UpdateTaskProviderState(log.TaskID, log.ProviderRequestID, stage, nextPollAt); err != nil {