<@U55GAGW0J>: can you elaborate please? Does not i...
# coroutines
e
@wouterdoeland: can you elaborate please? Does not it work or what?
w
elizarov: I got an expection about there not being a transaction or something. Unfortunately I have already removed the code and switched to handwritten SQL statements so I don't have the code anymore. But basically, I got an exception when trying to call User.find in a coroutine (
launch(CommonPool)
and in ktor)
e
Can you reproduce it with some selfcontained code and share it?
w
Wait a minute... Do your transactions have to be in a transaction block? If so then sorry, my fault.
o
Try #exposed to talk to devs, but I suspect it is not coroutines-ready, because it stores transactions in Thread Local, and coroutine continuation can be scheduled to any thread on a pool. What’s worse, even if you constrain dispatcher to only dispatch on the same thread, several coroutines can be running on a same thread, so their transactions could be messed up. You might need a special coroutine-enabled TransactionManager in Exposed.
If you wish to do something on a cutting edge, you might try
squash
, it doesn’t store transaction in a thread local, but instead relies on lambda closures to have it handy. But it’s not coroutine-first (like ktor) still, so some work might be done. I have it on the radar to make an async coroutine-first SQL lib, but don’t have quite enough time right now.