feat(task): introduce task timeout configuration and cleanup unfinished tasks

- Added TaskTimeoutMinutes constant to configure the timeout duration for asynchronous tasks.
- Implemented sweepTimedOutTasks function to identify and handle unfinished tasks that exceed the timeout limit, marking them as failed and processing refunds if applicable.
- Enhanced task polling loop to include the new timeout handling logic, ensuring timely cleanup of stale tasks.
This commit is contained in:
CaIon
2026-02-22 17:59:38 +08:00
parent fb494c12d6
commit bc7c5cf9cf
4 changed files with 75 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ var NotificationLimitDurationMinute int
var GenerateDefaultToken bool
var ErrorLogEnabled bool
var TaskQueryLimit int
var TaskTimeoutMinutes int
// temporary variable for sora patch, will be removed in future
var TaskPricePatches []string