Browse Source

bug fix for status change

master
filesite 7 months ago
parent
commit
6b2e0f3973
  1. 4
      lib/taskMoniter.mjs
  2. 1
      spider.mjs

4
lib/taskMoniter.mjs

@ -101,9 +101,9 @@ class TaskMoniter {
return false; return false;
} }
this.taskStatus[this.tasks[task_id].status] --;
this.tasks[task_id].status = this.statusCode.waiting; this.tasks[task_id].status = this.statusCode.waiting;
this.tasks[task_id].updated = common.getTimestampInSeconds(); this.tasks[task_id].updated = common.getTimestampInSeconds();
this.taskStatus[this.tasks[task_id].status] --;
this.taskStatus[this.statusCode.waiting] ++; this.taskStatus[this.statusCode.waiting] ++;
return true; return true;
@ -133,10 +133,10 @@ class TaskMoniter {
return false; return false;
} }
this.taskStatus[this.tasks[task_id].status] --;
this.tasks[task_id].status = this.statusCode.failed; this.tasks[task_id].status = this.statusCode.failed;
this.tasks[task_id].updated = common.getTimestampInSeconds(); this.tasks[task_id].updated = common.getTimestampInSeconds();
this.taskStatus[this.statusCode.failed] ++; this.taskStatus[this.statusCode.failed] ++;
this.taskStatus[this.statusCode.running] --;
return true; return true;
} }

1
spider.mjs

@ -129,7 +129,6 @@ import path from 'node:path';
spider_is_running = false; spider_is_running = false;
}else { }else {
console.error('No bot matched with url %s', task.url); console.error('No bot matched with url %s', task.url);
taskMoniter.setTaskRunning(task.id);
taskMoniter.setTaskFailed(task.id); taskMoniter.setTaskFailed(task.id);
} }
}, { }, {

Loading…
Cancel
Save