Fork me on GitHub
#core-async
<
2019-02-12
>
dehli21:02:52

Has anyone run into this issue before? https://dev.clojure.org/jira/browse/ASYNC-110 I have a top-level go block which seems to be causing the issue and I would like to keep it top level but I'm not sure how to address the problem

noisesmith21:02:38

I understand this is cljs and different rules apply, but my prejudice coming from clj is to not allocate stateful resources in top level code, even something as trivial as wrapping it in a delay that gets forced via -main is an improvement over top level side effects

noisesmith21:02:04

or a declare at the top level, and an assignment to the declared var via set! in -main

dehli21:02:45

thanks! that makes sense to me. i'm writing this for an aws lambda function and if you execute code on load of the script you get performance benefits which is why I want it top-level.

dehli21:02:34

sticking it in -main would work, however the way the project is currently setup has only one -main to speed up build times 🙂

noisesmith21:02:44

oh, with multiple possible execution paths decided on startup, right, I can see the advantage of that

dehli21:02:40

ya! it's working well so far. I could always switch to native javascript promises for this setup but hopefully there's a workaround!