Skip to content

Commit 075b982

Browse files
committed
Return spider in setEmptySleepTime itself for chainning.
1 parent ac912e8 commit 075b982

File tree

1 file changed

+6
-3
lines changed
  • webmagic-core/src/main/java/us/codecraft/webmagic

1 file changed

+6
-3
lines changed

webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,10 @@ public void run() {
333333
}
334334
} else {
335335
// wait until new url added,
336-
if (waitNewUrl())
337-
//if interrupted
336+
if (waitNewUrl()) {
337+
//if interrupted
338338
break;
339+
}
339340
continue;
340341
}
341342
}
@@ -805,11 +806,13 @@ public Scheduler getScheduler() {
805806
* Set wait time when no url is polled.<br><br>
806807
*
807808
* @param emptySleepTime In MILLISECONDS.
809+
* @return this
808810
*/
809-
public void setEmptySleepTime(long emptySleepTime) {
811+
public Spider setEmptySleepTime(long emptySleepTime) {
810812
if(emptySleepTime<=0){
811813
throw new IllegalArgumentException("emptySleepTime should be more than zero!");
812814
}
813815
this.emptySleepTime = emptySleepTime;
816+
return this;
814817
}
815818
}

0 commit comments

Comments
 (0)