Browse Source

🎈 perf: 优化抢课分配算法

Pchen. 1 month ago
parent
commit
89ea28a141
1 changed files with 6 additions and 0 deletions
  1. 6 0
      lib/QK/TaskScheduler.js

+ 6 - 0
lib/QK/TaskScheduler.js

@@ -1404,6 +1404,12 @@ class TaskScheduler {
             return true
             return true
         }
         }
 
 
+        // 客户端被收回槽位、窗口关闭等导致的被动停止,应重新分配而非标为失败
+        const exitReason = String(payload.exit_reason || payload.reason || '').trim()
+        if (failureType === 'stopped' || exitReason === 'stopped' || message.includes('任务已停止')) {
+            return true
+        }
+
         const autoRelogin = Number(task?.auto_relogin) === 1
         const autoRelogin = Number(task?.auto_relogin) === 1
         if (autoRelogin) {
         if (autoRelogin) {
             // 新版可传 type=login_expired;旧版仅 message / result.message
             // 新版可传 type=login_expired;旧版仅 message / result.message