-
Notifications
You must be signed in to change notification settings - Fork 788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update docs for BlazeClientBuilder #3410
Conversation
Make it explicit that ExecutionContext.global should be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, wow. I thought global
defaulted to at least two, but it looks like not. Yes, that would be a good additional warning to give.
At this point Also, if we advice clients not to use What do you think? |
So the two options:
In practice, I've always used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's long past time to give people an easy and correct enough answer. If we want a fixed thread pool, we need to point them to an easier way to create one in subsequent work.
I think recommending It sounds to me like an upstream change in cats-effect is the only way to make this ergonomic and safe. |
Make it explicit that
ExecutionContext.global
should be usedBased on the discussion in #3330, it sounds to me that http4s requires this parameter because of a leaky implementation detail in Blaze, and that the right answer always is
ExecutionContext.global
. It doesn't hurt to point this out in the scaladoc.A side note here: I see that the execution context is used to submit tasks to an
ExecutorService
. IfExecutionContext.global
only has one thread, is it still safe to use it without risking deadlocks? I assume this is one of the reasons cats-effect/IOApp defaults to minimum two threads backing theContextShift
.