File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -296,7 +296,6 @@ export class LogParser {
296296 */
297297 getTasks ( ) : TaskInfo [ ] {
298298 const tasks : TaskInfo [ ] = [ ]
299- const taskMap = new Map < string , TaskInfo > ( ) // 用于去重,避免IPC导致的重复任务(使用uuid+task_id作为key)
300299
301300 // 遍历所有事件,提取任务信息
302301 for ( let i = 0 ; i < this . events . length ; i ++ ) {
@@ -306,9 +305,16 @@ export class LogParser {
306305 if ( message === 'Tasker.Task.Starting' ) {
307306 const taskId = details . task_id
308307 const uuid = details . uuid || ''
309- // 使用uuid+task_id作为唯一标识,支持task_id在不同controller间重用
310- const taskKey = `${ uuid } _${ taskId } `
311- if ( taskId && ! taskMap . has ( taskKey ) ) {
308+
309+ // 检查是否是重复的任务(IPC导致的重复事件)
310+ // 只有当存在相同uuid+task_id且未结束的任务时才认为是重复
311+ const isDuplicate = tasks . some ( t =>
312+ t . uuid === uuid &&
313+ t . task_id === taskId &&
314+ ! t . end_time
315+ )
316+
317+ if ( taskId && ! isDuplicate ) {
312318 const task = {
313319 task_id : taskId ,
314320 entry : this . stringPool . intern ( details . entry || '' ) ,
@@ -322,7 +328,6 @@ export class LogParser {
322328 _startEventIndex : i
323329 }
324330 tasks . push ( task )
325- taskMap . set ( taskKey , task )
326331 }
327332 } else if ( message === 'Tasker.Task.Succeeded' || message === 'Tasker.Task.Failed' ) {
328333 const taskId = details . task_id
You can’t perform that action at this time.
0 commit comments