Commit 42bbe40a authored by yihua.huang's avatar yihua.huang

[Bugfix]Urls will be lost when call setScheduler() #104

parent aae1ab2c
...@@ -185,7 +185,12 @@ public class Spider implements Runnable, Task { ...@@ -185,7 +185,12 @@ public class Spider implements Runnable, Task {
*/ */
public Spider setScheduler(Scheduler scheduler) { public Spider setScheduler(Scheduler scheduler) {
checkIfRunning(); checkIfRunning();
Scheduler oldScheduler = this.scheduler;
this.scheduler = scheduler; this.scheduler = scheduler;
Request request;
while ((request = oldScheduler.poll(this)) != null) {
this.scheduler.push(request, this);
}
return this; return this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment