Skip to content

Continue internal Queue execution also after fiber is suspended #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2022

Conversation

clue
Copy link
Member

@clue clue commented Jun 23, 2022

This simple changeset updates the internal Queue class to continue execution also after a fiber is suspended (PHP 8.1+). In particular, this is needed to make our new Async v4 package compatible with Promise v3 (reactphp/async#48).

The added test cases are the gist of why our Async integration currently fails with Promise v3 only (reactphp/async#48), but other than that I agree that they might look a bit weird. I don't particularly care about how an individual promise behaves if a fiber is suspended (perfectly reasonable to argue in either direction), but the original version has some severe problems as all promises start to fail once a fiber is suspended.

This is the minimal changeset I could come up with, but I understand that this reverts parts of the iterative logic introduced in #28/#82/#86. The test suite confirms my changes do not break any of the known assumptions and in fact bring the execution order more in line with how Promise v2 and v1 work (this causes the build error in friends-of-reactphp/mysql#157 and likely also in reactphp/socket#214). I would suggest we should look into this iterative logic and its consequences again in a follow-up PR if we see a need for this. Until we can come up with more specific test cases that highlight now the original iterative logic is needed, I would argue that merging this as is to move forward with reactphp/async#48 seems reasonable.

@clue clue added this to the v3.0.0 milestone Jun 23, 2022
@clue clue requested a review from WyriHaximus June 23, 2022 09:11
@WyriHaximus WyriHaximus merged commit 033dc5f into reactphp:3.x Jun 23, 2022
@clue clue deleted the queue-fibers branch June 25, 2022 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants