https://kotlinlang.org logo
c

christophsturm

04/30/2021, 1:42 PM
does expose always use threadLocals? i thought that if I pass around a database and always specify the database like
transaction(db) {..}
it will avoid threadlocals, but it seems that all exposed calls inside the transaction still get their transaction from a threadlocal. so it only works if the thread stays the same, and for example it wont work if i have callbacks (or coroutines) that potentielly run in different threads.
e

Emil Kantis

04/30/2021, 5:00 PM
I think you're supposed to use
suspendedTransaction { }
when working with coroutines
c

christophsturm

05/01/2021, 1:14 PM
thanks! my question was more general in regards of explicit dependencies vs implicit dependencies and api design
4 Views