-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
refactor: remove calls to tokio_util::block_on #3059
Conversation
So this task has proven to be a worthy oponent. Writing this down to get other peoples opinions as my knowledge of futures and Tokio runtime comes lacking. Currently I'm stuck with a few more calls to Here's output from one of failing test:
The test fails with following error:
Even though the server is working and accepting connections above error is returned. In turn it causes CC @ry @piscisaureus @kevinkassimo @afinch7 @95th EDIT: I also tried to rewrite the tests to use async functions and run futures via |
@bartlomieju In the tests that you're getting this error, are we using the single or multithread runtime? Maybe if it's a single thread runtime, wait() blocks everything. Is it possible to modify this PR so it's just removing some of the block_on calls, and leave the troublesome ones? |
We're using "default" runtime which has as many threads as there's CPUs. I tweaked it manually but no success.
Yes, trying to get CI green |
05eb0d5
to
d6bf739
Compare
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.
Not sure I counted correctly but this seems to remove as many block_on calls as it adds. I would land anything that’s nets a removal of call sites.
@ry I'm still tinkering with it... I'm not sure that can be solved some other way around. Maybe we could minimize the impact of |
Maybe just wait until we have a proper fix. |
I give up for now, let's do that... |
@ry after all I rewritten some of the tests to remove |
I'm happy as long as there is a net removal of
|
26880ce
to
d8e6ad1
Compare
Effectively we're left with only one call: //cli/file_fetcher.rs
...
/// Required for TS compiler.
pub fn fetch_source_file(
self: &Self,
specifier: &ModuleSpecifier,
) -> Result<SourceFile, ErrBox> {
tokio_util::block_on(self.fetch_source_file_async(specifier))
}
... EDIT:
|
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.
LGTM - nice clean up - we're almost there!
Removes as many calls to
tokio_util::block_on
as possible