I have many kotlin scripts that suspend querying e...
# scripting
l
I have many kotlin scripts that suspend querying external services. The problem I am having is that I am having to create many script engines because as far as I understand running engine.eval isn't thread safe. Is this correct? Is there anyway to run scripts that suspend and not eat up an entier thread? or si the recommended usage is to make sure eval is never running on different threads?
@ilya.chernikov ?
i
It is not really thread-safe, right. If you don't need JSR-223 and REPL, then the solution would be to separate compilation and evaluation using new scripting API. Then you can have one compiler - which is heavy, and then evaluate scripts independently in separate threads or coroutines context.