Fuel: The console application does not terminate after a successful request

Created on 14 Jul 2017  路  5Comments  路  Source: kittinunf/fuel

I developing console application on Kotlin. If I make a request from the main thread and request finishes (successful or not, doesn't matter) application won't close for a minute. Is that normal behavior? Is there a way to stop execution right after result handler finishes its execution?

Request:

Fuel.get("/info").responseString { _, _, result ->
        when (result) {
            is Result.Failure -> {
                println("Failure")
            }
            is Result.Success -> {
                println("Success")
            }
        }
    }
question

All 5 comments

Just noticed the same problem. I'm guessing it's a problem with the jvm waiting for the async thread to officially close, because if you use the non-async version it terminates immediately.

Fuel opens a daemon thread that prevents the JVM from shutdown.
You can try this code to shutdown Fuel, though it should probably provide a better masochism for that:

FuelManager.executor.shutdownNow()

Is someone familiar with how OKHttp handles that?

Same as #99

can we close this?

Yes, @yoavst solution works. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

t-ae picture t-ae  路  5Comments

easazade picture easazade  路  6Comments

IvanKulikov picture IvanKulikov  路  5Comments

iNoles picture iNoles  路  5Comments

erikthered picture erikthered  路  7Comments