Hi everyone! I'm Carlos, a backend engineer at Nubank who loves Clojure 😄
I've been trying holy-lambda for last few days and I really like it! I'm just running with an issue when trying to compile using bb hl:compile . It happens when I call the d/connect function (or any other datomic.api function) in my project. If I remove it the problem disappears... Do you have any clue why this might be happening?
Hi @karol.wojcik! Awesome, thanks for sharing. At the moment I'm just exploring.
It's important to say that the issue is that the terminal blocks 😅
does d/connect make a non-daemon thread?
and are you calling it at the top level of your code like
(def conn (d/connect))because my first guess is that you are making AOT hang
Yes I'm calling it like you say
How should it be done?
Do you know where can I find some docs about it?
so this isn’t about holy lambda so much as its about AOT in general
i would call it like this
(defn connect-to-datomic
[]
(d/connect opts))
(defn start-system
[]
{:datomic (connect-to-datomic)})
;; then in your entrypoint
(... (let [system (start-system!)]
(... do code ...)
// potentially clean up beteen invocations ...)but the “lazy” solution for you to get your stuff working is just
(def conn (delay (d/connect)))and then replace your usages of conn with @conn
Works just as you say, thanks for your help!
@emccue @carloshernandez2.1b very good explanation. Will NuBank use holy-lambda in production?
Btw hl:compile does nothing special. It's an alias for the command that compiles a project with an AOT, since uberjar happens locally via depstar now. The reason hl:compile exists is to inform hl:native:conf how the project should be compiled for the GraalVM agent.
Planning to move to tools.build in the next release.