Skip to content
Permalink
v1
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
def fetchAllLinksParallel(startTitle: String, depth: Int): Set[String] = {
var seen = Set(startTitle)
var current = Set(startTitle)
for (i <- Range(0, depth)) {
val futures = for (title <- current) yield Future{ fetchLinks(title) }
val nextTitleLists = futures.map(Await.result(_, Inf))
current = nextTitleLists.flatten.filter(!seen.contains(_))
seen = seen ++ current
}
seen
}