Fork me on GitHub
#aws
<
2020-05-17
>
Gleb Posobin21:05:47

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?

ghadi22:05:32

clients are not designed to be def'fed top-level. wrap it in a delay if you really need it top-level

Gleb Posobin22:05:10

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.

ghadi22:05:12

that being said, it's unclear what you're specifically running into

ghadi22:05:42

(there are some side-effects of client construction that may be undesired)

ghadi22:05:33

in the REPL for exploration I think it's fine, yes it's similar to top-level in a namespace

ghadi22:05:08

you can run jstack on the jvm to tell you what is hung

ghadi22:05:10

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

👍 4
ghadi22:05:07

i'm curious what it's hung on...