Created
June 14, 2018 14:44
-
-
Save adamw/d527f7d9d15ebb2d20d463ff815f538e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def crawlUrl(url: Url): Unit = { | |
if (!visitedLinks.contains(url)) { | |
visitedLinks += url | |
inProgress += url | |
actorFor(url.host) ! Crawl(url) | |
} | |
} | |
private def actorFor(host: Host): ActorRef = { | |
workers.get(host) match { | |
case None => | |
val workerActor = context.actorOf(Props(new Worker(http, parseLinks, self))) | |
workers += host -> workerActor | |
workerActor | |
case Some(ar) => ar | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment