simon.vergauwen
07/07/2020, 9:59 AMsimon.vergauwen
07/07/2020, 10:01 AMrunBlocking
on a Future
scheduled on a ExecutorService
.
I'm not sure where it's going wrong.
The cancellation is not correctly wired atm afaik between KotlinX & Arrow Fx, altough seeing the implementation I wasn't sure if that was necessary.
Side question, would it be possible as a user to write a custom SpecRunner
?simon.vergauwen
07/08/2020, 2:30 PMrunBlocking
, without an argument passed for ctx
.
That means that KotlinX creates and launches an EventLoop
on every test. Is that correct?sam
07/08/2020, 2:34 PMsimon.vergauwen
07/08/2020, 2:35 PMsam
07/08/2020, 2:37 PMsam
07/08/2020, 2:37 PMsimon.vergauwen
07/08/2020, 2:38 PMsimon.vergauwen
07/08/2020, 2:38 PMsimon.vergauwen
07/08/2020, 2:38 PMsimon.vergauwen
07/08/2020, 2:42 PMFuture
you should be able to easily remove that runBlocking
by using an async constructor for Future
and using startCoroutine
instead.
I could POC that if you're interested to see what it'd look like.simon.vergauwen
07/08/2020, 2:43 PMsam
07/08/2020, 2:46 PMsimon.vergauwen
07/08/2020, 2:48 PMsam
07/08/2020, 2:49 PMsimon.vergauwen
07/08/2020, 2:49 PMsuspend { test() }.startCoroutine(Continuation(ctx) { /* complete async Future constructor */ })
simon.vergauwen
07/08/2020, 2:50 PMsam
07/08/2020, 2:50 PMsimon.vergauwen
07/08/2020, 2:51 PMsimon.vergauwen
07/08/2020, 2:52 PMsuspend
function in a Future
runtime without using KotlinX.simon.vergauwen
07/08/2020, 2:53 PMFuture
and nothing else.sam
07/08/2020, 2:54 PMsam
07/08/2020, 2:54 PMsimon.vergauwen
07/08/2020, 2:54 PMsimon.vergauwen
07/08/2020, 2:55 PMSo it's not doing any of the coroutine dispatcher stuffYou're suspend functions can still be using these KotlinX dispatchers in user land if they want
sam
07/08/2020, 2:55 PMsimon.vergauwen
07/08/2020, 2:55 PMsam
07/08/2020, 3:00 PM