-
Notifications
You must be signed in to change notification settings - Fork 751
Description
Is your request related to a problem? Please describe.
As tokio
is already being used in jj
, pollster
is somewhat unneeded and can cause deadlock-type issues.
Describe the solution you'd like
I'd like the uses of pollster
to be replaced with using tokio::task::block_in_place
, followed by Handle::current
(or Handle::try_current
on Result types where panicking would be unideal) for retrieving a handle to the tokio runtime, and finishing off with block_on
to actually do the blocking. This boilerplate could be handled by a macro or another crate, I don't know.
Describe alternatives you've considered
Modifying anything that actually needs to run async code (for example, traits) to actually return a result and in implementations which don't need async, use std::future::ready
.
Note: ideally, as to not wait for the complexity needed for this rewrite, this bandaid fix would be implemented immediately, followed by the future::ready
idea asap.
Additional context
Testing would need to be modified. 2 obvious solutions:
- Create a
tokio
runtime for the tests - would also make it more stable as traits provided bytokio
are being used INSIDE of what is being tested - Allow for
pollster
by usingHandle::try_current
instead ofHandle::current
and falling back topollster
, although that seems like a bandaid fix