Fork me on GitHub
Eric Dahlseng19:09:57

Does anyone know why spec/check seems to take forever to cleanup? In the following minimally reproducible example, Clojure takes ~60 seconds to shutdown after "Done" is printed, but exits immediately if the check call is removed:

(ns test
  (:require [clojure.spec.alpha :as spec]
            [clojure.spec.test.alpha :as spec-test]))

(spec/def ::number number?)

(spec/fdef plus
           :args (spec/or
                  :nothing (spec/cat)
                  :numbers (spec/* ::number))
           :ret (spec/or
                 :number ::number))

(defn plus [& values]
  (apply + values))

(defn -main [& args]
  (spec-test/check `plus)
  (println "Done"))


@edahlseng There's probably a thread pool that it is waiting on. Call (shutdown-agents) in -main to solve that.

‼️ 2
Eric Dahlseng19:09:07

@seancorfield, that works wonderfully! I wasn't aware of (shutdown-agents), thanks for the tip!


There's lots of good stuff in the FAQ.

Eric Dahlseng19:09:35

There definitely is. I've ended up there through some Google searches, but haven't given it a direct read through otherwise. Looks like I should do that now to preempt future questions!