Closed wngr closed 3 years ago
I gave up on async-spawner and decided on just using async-global-executor in my projects.
Not saying that that decision shouldn't be revisited. But option 2 seems like the most sensible approach. Are you interested in coming up with a PR? Otherwise I can take a look on Monday
Yes, I will give it a try!
ipfs-embed is a library, which is to be used not standalone, but embedded in bigger applications. It should be the decision of the user, where and how the futures spawned by this library are executed.
The currently used
async_global_executor
offers the possibility to select the runtime, but uses a global resource to store a handle to said runtime, which can only be initialized once. This is restricting in a sense, such that users can't replace a runtime without restarting the process (users might want to do that in order to implement the Let It Crash pattern within process boundaries).I see the following possibilities to provide that:
async_global_executor
uses a global resource; not sure about your future intentions with this crate, tooNow I reckon that the public API of ipfs-embed will probably not become nicer by exposing that, but we might guard it behind a feature flag, defaulting to
async_global_executor
like it is right now.