I am using cognitect's aws api, and creating an api client with (aws/client {:api :s3 ...})
, for some reason it gets stuck when called from a namespace on repl init (i.e. I add (def x (aws/client ...))
call to the namespace which is marked as init-ns
in my project.clj
, run lein repl
and it hangs), but works if I comment it out in the namespace and run (def x (aws/client ...))
inside the repl after the repl has started up. In the repl it works quickly, certainly in under a second, I've tried larger repl timeout than the default 30s, it doesn't help. Any ideas what could be the cause of this?
clients are not designed to be def'fed top-level. wrap it in a delay
if you really need it top-level
Ok, thanks! Out of curiosity, what's the difference between when it is top-level vs when it is not? What breaks? I assumed that writing lines in the repl is the same as basically appending the lines to the namespace repl is in.
that being said, it's unclear what you're specifically running into
(there are some side-effects of client construction that may be undesired)
in the REPL for exploration I think it's fine, yes it's similar to top-level in a namespace
you can run jstack
on the jvm to tell you what is hung
we have some upcoming changes that may make it easier to def a client top-level @posobin, but it's not an explicit goal of those changes
i'm curious what it's hung on...