Closed suhaboncukcu closed 6 years ago
As long as the objects that passed to \React\Promise\all
implement the method then
, it works very well. E.g. \React\Promise\all
works very fine with with \React\Promise\Promise()
and also with \GuzzleHttp\Promise\Promise
.
So far I'm not able to reproduce this issue.
As you can see in the documentation the always
-method doesn't accept any parameter. Consider to use then
instead of always
if you in need of a parameter.
Also consider that file_put_contents
MAY blocking the event-loop.
I hope this helps :+1:
Thanks @legionth , I've altered my code to use then
instead. I've also realized the reason behind my problem. It seems when I use 'save_to'
parameter; it somehow resolves the promise instantly. I'll open a bug to the guzzle repo since I am now able to handle the issue.
It is awesome to have reactphp namespace and this promise repo. Thank you so much for that.
In the documentation, it says that this function will return a promise which will resolved after all the promises in the array have resolved.
Here is my implementation;
Now, everything is fine till this point. But want I want to do is get
$contents
from a request to my server. So I have a server implementation;What I expect here that
$server
returns an immediate response (which it does) and after a while see themeh.txt
in my repo. However, it never falls toalways
callback. And even when I don't chain any function onall
method, it just resolves itself. Shouldn't it wait untilthen
or something similar to be called?