Created
February 6, 2015 17:52
-
-
Save santosh79/8a45719d827571366b14 to your computer and use it in GitHub Desktop.
This file contains 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
find_broken_links(Urls) -> | |
lists:foreach(fun(Url) -> spawn(url_checker, is_working_url, [self(), Url]) end, Urls) | |
get_results(length(Urls)). | |
get_results(N) -> get_results(0, N, []). | |
get_results(N, N, BrokenLinks) -> {ok, BrokenLinks}; | |
get_results(Cnt, N, BrokenLinks) -> | |
receive | |
{_Client, Url, true} -> get_results(Cnt + 1, N, BrokenLinks); | |
{_Client, Url, false} -> get_results(Cnt + 1, N, [Url|BrokenLinks]) | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment