ubuntu - Clojure program can't complete after running -
my problem unexpected situation executing clojure program.
i use ubuntu 14.04 x64, lein , clojure(both last versions). i've finished little project(web crawler, learning clojure). works, i'm sure('cos i've run in repl).
ok, i'm trying run lein in terminal (look @ screenshot). works correct, prints elapsed time. then, it's waiting something. that's problem. program can't stop , can't give contol ubuntu's terminal. i've faced first time, projects before complited itself. way "ctrl + c". in code, use "imperative" commands(doseq, do), file i/o (with-open reader/writer), agents(send-off, await) , "clj-http.client" downloading webpages. potential causes.
here's "main":
(defn crawl-bunch [depth] (do (send-off urls visit-urls) (await urls) (renew-urls) (await urls) (send-off urls mark-used-urls) (await urls) (dec depth))) (defn crawl [depth] (loop [i depth] (if (= 0) (save-found-urls "out_urls.txt") (recur (crawl-bunch i))))) (defn -main [& args] (time (do (file-to-urls "urls.txt") (crawl 1)))) here's full source code - 100 strings (/src/crawler/core.clj): https://github.com/ivanpetrov16130/crawler
tell me please, how fix it? thank you answers , excuse me grammatical, syntax , logical errors.

you need run shutdown-agents in order thread pools used agents shut down.
Comments
Post a Comment