async-compat icon indicating copy to clipboard operation
async-compat copied to clipboard

Reuse existing tokio runtime if one exists

Open bonsairobo opened this issue 1 year ago • 1 comments

Fixes #29

bonsairobo avatar Feb 26 '24 21:02 bonsairobo

@notgull I also tried adding this test:

    #[test]
    fn fallback_runtime_is_created_if_none_exists() {
        futures::executor::block_on(async { println!("foo") }.compat());

        assert!(TOKIO1.fallback_rt.is_some());
    }

But I realized unit testing this is kind of challenging since all tests are running in parallel, and creating a runtime in one test might affect the outcome of a different test.

I could make them integration tests to run them in separate processes, although I would need some public API to inspect whether the fallback runtime was created.

bonsairobo avatar Feb 27 '24 08:02 bonsairobo

Anything I can help to push this forward? I have a perfect user case when using both uniffi and rustls-platform-verifier.

flisky avatar May 30 '24 14:05 flisky

Sorry, this one fell through the cracks. I'll review it once I have time.

notgull avatar May 30 '24 14:05 notgull