Fork me on GitHub
#mount
<
2019-05-07
>
erwinrooijakkers09:05:21

Is mount/start asynchronous?

erwinrooijakkers09:05:58

I have an error in mount/starting one component and I try start the Sentry component first, but no errors are logged to it…

erwinrooijakkers09:05:20

(defn -main [& args]
  (mount/start #'app.config/env)
  (mount/start #'app.core/sentry)
      (log/error "This error prints! But not to Sentry, while it should be initialized above")
      (System/exit 1)
  (.addShutdownHook (Runtime/getRuntime) (Thread. stop-app)))
So logging works and we see the log/error, but Sentry is not initialized still somehow

erwinrooijakkers10:05:01

Okay db in Luminus is loaded before

erwinrooijakkers10:05:12

So makes sense, only don’t know why it is required first

erwinrooijakkers10:05:38

It was because I included a dynamic variable in a require with :refer [*db*], it works when I use :alias db and then db/*db* in the code

erwinrooijakkers10:05:16

Mount takes the order of the compiler and the Clojure compiler probably gets explicit refers always, and refers via an alias in another way