eio icon indicating copy to clipboard operation
eio copied to clipboard

Prioritize returning Fiber.any value over cancelling quickly

Open adamchol opened this issue 6 months ago • 3 comments

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.

adamchol avatar May 27 '25 13:05 adamchol

The tests need updating too (CI is failing).

talex5 avatar Jun 13 '25 08:06 talex5

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.

adamchol avatar Jun 14 '25 21:06 adamchol

Hi again! Can I get some help with the remaining tests in CI, please? I would really benefit from this PR being merged.

adamchol avatar Jun 25 '25 15:06 adamchol

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.

talex5 avatar Jul 04 '25 08:07 talex5

Thanks! Done!

adamchol avatar Jul 12 '25 08:07 adamchol

Hi! Can this be merged now, please?

adamchol avatar Jul 28 '25 15:07 adamchol

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!

talex5 avatar Aug 08 '25 10:08 talex5

Done!

adamchol avatar Aug 11 '25 17:08 adamchol