saket / unfurl

Generate link previews, inspired by Slack.
Apache License 2.0
267 stars 11 forks source link

Coroutines support #5

Closed 1fexd closed 2 months ago

1fexd commented 2 months ago

The coroutines support introduced in 2.0.0 doesn't actually support coroutines as far as I am aware, since it still uses OkHttp's threading - I think you'd have to use something like gildor/kotlin-coroutines-okhttp

saket commented 2 months ago

Whoops, good catch, thank you. I was able to use gildor/kotlin-coroutines-okhttp for canceling OkHttp requests when the coroutine scope is canceled. However, the downside of doing this is that the requests are no longer run in a blocking manner, and will now use OkHttp's own thread pool. I guess that's okay?

https://github.com/saket/unfurl/releases/tag/2.2.0

1fexd commented 2 months ago

However, the downside of doing this is that the requests are no longer run in a blocking manner, and will now use OkHttp's own thread pool. I guess that's okay?

I'm not an expert on this topic but I think that's fine, yeah