refactor(relay): improve channel locking and retry logic in RelayTask

- Enhanced the RelayTask function to utilize a locked channel when available, allowing for better reuse during retries.
- Updated error handling to ensure proper context setup for the selected channel.
- Clarified comments in ResolveOriginTask regarding channel locking and retry behavior.
- Introduced a new field in TaskRelayInfo to store the locked channel object, improving type safety and reducing import cycles.
This commit is contained in:
CaIon
2026-02-21 23:47:55 +08:00
parent 76892e8376
commit cda540180b
3 changed files with 36 additions and 18 deletions

View File

@@ -619,6 +619,11 @@ type TaskRelayInfo struct {
PublicTaskID string
ConsumeQuota bool
// LockedChannel holds the full channel object when the request is bound to
// a specific channel (e.g., remix on origin task's channel). Stored as any
// to avoid an import cycle with model; callers type-assert to *model.Channel.
LockedChannel any
}
type TaskSubmitReq struct {