When running this `println("received update."); la...
# coroutines
w
When running this
println("received update."); launch(CommonPool) { println("in pool"); //more code }
code on my desktop, it does print
received updated.
and
in pool
, but when running it on an Digital Ocean droplet it only prints
received update.
. Any reason why?
o
Can it be that your main function exits before scheduled code runs? Does adding
sleep
helps?
w
No, I already have infinite sleep
o
That’s weird, can you test that direct use of `CompletableFuture`works?
w
Where should I put that? Replace launch(CommonPool) with CompletableFuture.runAsync ?
o
Yep, something like this
w
It doesn't compile because a suspending function should only be called from a coroutine or other suspending function. Is there a way to ignore these errors and run a suspending function on the main thread/not in a coroutine?
I just don't get why it won't run on my server. I have openjdk8 installed in it on Ubuntu 16.04
o
Well, you don’t need to put suspending function inside, just println or something. But if you have really some more complex code, you might want to check if it throws and exception is lost/ignored or something.
w
How would I do that, because the first function that is being run is
println("in pool")
Even with only that function in it it doesn't print
"in pool"
e
Can you reproduce the problem with some small use-case? Does it persist without "more code" inside?