Skip to content

Instantly share code, notes, and snippets.

@adamw
Created June 14, 2018 14:45
Show Gist options
  • Save adamw/8c954e4eea287d2d2cad9241fb17ea95 to your computer and use it in GitHub Desktop.
Save adamw/8c954e4eea287d2d2cad9241fb17ea95 to your computer and use it in GitHub Desktop.
override def receive: Receive = {
case Start(start) =>
crawlUrl(start)
case CrawlResult(url, links) =>
inProgress -= url
links.foreach { link =>
crawlUrl(link)
referenceCount = referenceCount.updated(link.host,
referenceCount.getOrElse(link.host, 0) + 1)
}
if (inProgress.isEmpty) {
result.success(referenceCount)
context.stop(self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment