diff --git a/lib/taskMoniter.mjs b/lib/taskMoniter.mjs index 330cd3a..6ad3db2 100644 --- a/lib/taskMoniter.mjs +++ b/lib/taskMoniter.mjs @@ -101,9 +101,9 @@ class TaskMoniter { return false; } + this.taskStatus[this.tasks[task_id].status] --; this.tasks[task_id].status = this.statusCode.waiting; this.tasks[task_id].updated = common.getTimestampInSeconds(); - this.taskStatus[this.tasks[task_id].status] --; this.taskStatus[this.statusCode.waiting] ++; return true; @@ -133,10 +133,10 @@ class TaskMoniter { return false; } + this.taskStatus[this.tasks[task_id].status] --; this.tasks[task_id].status = this.statusCode.failed; this.tasks[task_id].updated = common.getTimestampInSeconds(); this.taskStatus[this.statusCode.failed] ++; - this.taskStatus[this.statusCode.running] --; return true; } diff --git a/spider.mjs b/spider.mjs index 76b6c80..d80a30f 100644 --- a/spider.mjs +++ b/spider.mjs @@ -129,7 +129,6 @@ import path from 'node:path'; spider_is_running = false; }else { console.error('No bot matched with url %s', task.url); - taskMoniter.setTaskRunning(task.id); taskMoniter.setTaskFailed(task.id); } }, {