Created
June 14, 2018 15:36
-
-
Save adamw/bb178a51870b53a53d62d356f3c3e4ba 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
def crawlUrl(data: CrawlerData, url: Url): IO[Nothing, CrawlerData] = { | |
if (!data.visitedLinks.contains(url)) { | |
workerFor(data, url.host).flatMap { | |
case (data2, workerQueue) => | |
workerQueue.offer(url).map { _ => | |
data2.copy( | |
visitedLinks = data.visitedLinks + url, | |
inProgress = data.inProgress + url | |
) | |
} | |
} | |
} else IO.now(data) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment