Skip to content

Navigation Menu

Sign in
Sign up

Added async support to the interface. - #969

Open
benelori wants to merge 1 commit into
overblog:master from
benelori:async
Open

Added async support to the interface. #969
benelori wants to merge 1 commit into
overblog:master from
benelori:async

Conversation

@benelori

@benelori benelori commented Dec 18, 2021
edited by murtukov
Loading

Copy link
Copy Markdown
Contributor
Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Documented? no
Fixed tickets #970
License MIT

This PR adds support for ReactPHP promises, because the wait() method of the current executor is synchronous and it will block the event loop.

This is more like a hack btw, because it's the first time I dove into the project and I needed something to work for my current work, which has ReactPHP.

I have issues with adding yet another flag to be honest and I'm not sure how to solve the issue with the controller, which will need to something like this in the createResponse method

if ($payload instanceof Promise) {
 return new ReactPromise(
 function ($resolve) use ($payload) {
 $payload
 ->then(
 function (ExecutionResult $result) use ($resolve) {
 $resolve(new JsonResponse($result->toArray(), 200));
 },
 function ($error) {
 $reject($error);
 }
 );
 }
 );
}

I would be glad to implement this properly, so I would like to ask for some opinions, on how this actually should look like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /