eio
eio copied to clipboard
Prioritize returning Fiber.any value over cancelling quickly
This makes changes in Fiber.any to prioritize returning the value rather than cancelling the whole Fiber.any from the outside if we already have the value from one of it's functions. A sample code showing a specific scenario and more detailed explanation are in the issue #805.
Let me know if this is reasonable to merge.
The tests need updating too (CI is failing).
I changed the test from fiber.md and the description of it to showcase the priority on returning the value.
I'm not sure about the rest of the tests in the CI. One of them is new I think and I don't know how the rest is related to the code I modified. Tried to reproduce those locally but unsuccessfully because of some environment problems with docker. I might need some help with the rest of those CI tests.
Hi again! Can I get some help with the remaining tests in CI, please? I would really benefit from this PR being merged.
Rebasing on main should fix most of the CI problems (see #808). The ERROR while compiling mdx.2.5.0 on OCaml 5.4-alpha1 is due to https://github.com/realworldocaml/mdx/issues/469 and can be ignored.
Thanks! Done!
Hi! Can this be merged now, please?
I've rebased it and squashed (so there are no commits in the history with failing tests). I slightly modified the test to check that the parent cancellation takes effect on the next yield.
I don't have permission to update your branch (possibly because it's on main), so I've pushed the commit here: https://github.com/talex5/eio/pull/new/fiber-any-keep-result
If you reset your branch to that version I'm happy to merge it - thanks!
Done!