http://fssnip.net/3K 코드를 사용하여 콘솔 프로그램을 만들었습니다. 스레드의 마무리를 기다릴 끝에 | 그리고F # MailboxProcessor questions
나는 "> 무시() System.Console.ReadLine"를 추가하는 거라고 것을 발견했다. 모든 MailBoxProcessors가 완료되었음을 알리는 것이 가능하고 프로그램이 종료 될 수 있습니까?
테스트 URL "www.google.com"을 잘못된 URL로 변경하려고 시도했으며 다음과 같은 결과가 나타납니다. "출력 경주"를 피할 수 있습니까?
http://www.google.co1m crawled by agent 1. AgAAAent gent 3 is done. gent 2 is done. 5 is done. gent 4 is done. Agent USupervisor RL collector is done. is done. 1 is done.
[편집]
마지막 출력/크롤링 여전히 토마스의 갱신 http://fssnip.net/65 사용 후 종료됩니다. 다음은 "limit"을 5로 변경하고 디버깅 메시지를 추가 한 후의 프로그램 출력입니다. 마지막 줄에는 잘린 URL이 표시됩니다. 모든 크롤러가 처형을 완료했는지 감지하는 방법입니까? 내가 마지막에()를 Console.Readline을 추가하지 않으면
[Main] before crawl
[Crawl] before return result
http://news.google.com crawled by agent 1.
[supervisor] reached limit
http://www.gstatic.com/news/img/favicon.ico crawled by agent 5.
Agent 2 is done.
[supervisor] reached limit
Agent 5 is done.
http://www.google.com/imghp?hl=en&tab=ni crawled by agent 3.
[supervisor] reached limit
Agent 3 is done.
http://www.google.com/webhp?hl=en&tab=nw crawled by agent 4.
[supervisor] reached limit
Agent 4 is done.
http://news.google.com/n
나는 마지막
printfn "크롤링 [홈페이지]"이 실행되지 않습니다, 그러나
printfn "[Main] before crawl"
crawl "http://news.google.com" 5
|> Async.RunSynchronously
printfn "[Main] after crawl"
메인 코드를 변경 .
[편집 2]
코드는 fsi에서 잘 실행됩니다. 그것을 사용하여 실행 된 경우이 같은 문제가됩니다 FSI --use : Program.fs --exec --quiet
URL 크롤링을 해결하기위한 메일 박스 프로세서의 사용법은 너무 복잡하며 URL 콘텐츠 가져 오기는 비동기 호출이 아닙니다. 문제는 간단한 비동기 계산을 사용하여 쉽게 해결할 수 있습니다. – Ankur