Skip to content

Urls will be lost when call setScheduler() #104

@code4craft

Description

@code4craft

When call Spider.setScheduler(), the urls in old scheduler will be lost. Try to fix it by polling all urls from old scheduler and pushing to the new one.

public Spider setScheduler(Scheduler scheduler) {
    checkIfRunning();
    Scheduler oldScheduler = this.scheduler;
    this.scheduler = scheduler;
    Request request;
    while ((request = oldScheduler.poll(this)) != null) {
        this.scheduler.push(request, this);
    }
    return this;
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions