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

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

View File

@@ -13,6 +13,7 @@ import (
"regexp"
"strings"
"testing"
"time"
"infinite-canvas/backend/internal/protocol"
)
@@ -348,6 +349,18 @@ func TestDeclarativeProtocolRuntimeExecutesCreatePollAndDownload(t *testing.T) {
}
}
func TestDeclarativeProtocolPollingPolicyOnlyChangesVideoBehavior(t *testing.T) {
video := declarativeProtocolPollPolicy("video")
if video.InitialDelay != defaultVideoPollInterval || !video.RetryTransient {
t.Fatalf("video polling policy = %#v, want delayed resilient polling", video)
}
image := declarativeProtocolPollPolicy("image")
if image.InitialDelay != 0 || image.Interval != 2500*time.Millisecond || image.RetryTransient {
t.Fatalf("image polling policy = %#v, want legacy immediate fail-fast polling", image)
}
}
func TestDeclarativeProtocolPollRecoversFromTransientGatewayFailure(t *testing.T) {
adapter, err := protocol.LoadManifest([]byte(`{
"apiVersion":"yingce.plugin/v1",