我大致看了下源码,每个 project 有一系列 task,task 的流程大概是:
scheduler 从 new_task_queue 取 task 放到出队列 -> fetcher 执行 task 后把结果放到出队列 -> processor 把结果传给用户定义的 handler, 从中提取新的 task 放到 new_task_queue
把 task 放到数据库是在 scheduler 取 task 的时候.如果在 processor 执行完后,设状态为 stop,这时候 scheduler 检测到爬虫停止了,是不会把 new_task_queue 中的 task 放到数据库的,这样会不会有丢失 task 的可能?
scheduler 从 new_task_queue 取 task 放到出队列 -> fetcher 执行 task 后把结果放到出队列 -> processor 把结果传给用户定义的 handler, 从中提取新的 task 放到 new_task_queue
把 task 放到数据库是在 scheduler 取 task 的时候.如果在 processor 执行完后,设状态为 stop,这时候 scheduler 检测到爬虫停止了,是不会把 new_task_queue 中的 task 放到数据库的,这样会不会有丢失 task 的可能?