Since quite some time Guzzle added support for async requests:
https://docs.guzzlephp.org/en/stable/quickstart.html#async-requests
It is also available in the code base we ship, but currently not accessible as we wrap away guzzle with our
|
class Client implements IClient { |
Async requests would come in very handy and could help to speed up several requests were we don't care about the outcome, e.g. potential webhooks.
A method like the following would work
public function postAsync(string $uri, array $options = []): void {
$this->preventLocalAddress($uri, $options);
if (isset($options['body']) && is_array($options['body'])) {
$options['form_params'] = $options['body'];
unset($options['body']);
}
$this->client->requestAsync('post', $uri, $this->buildRequestOptions($options));
}
but it hides away the Promise option. But if we'd expose that, it would mean more wrapping or exposing Guzzle.
Unluckily the Async stuff is not part of the PSR, so we can't write a generic wrapper for that.
Other current solutions:
Any preferences?
cc @come-nc @ChristophWurst
Since quite some time Guzzle added support for async requests:
https://docs.guzzlephp.org/en/stable/quickstart.html#async-requests
It is also available in the code base we ship, but currently not accessible as we wrap away guzzle with our
server/lib/private/Http/Client/Client.php
Line 51 in 8aea25b
Async requests would come in very handy and could help to speed up several requests were we don't care about the outcome, e.g. potential webhooks.
A method like the following would work
but it hides away the Promise option. But if we'd expose that, it would mean more wrapping or exposing Guzzle.
Unluckily the Async stuff is not part of the PSR, so we can't write a generic wrapper for that.
Other current solutions:
Any preferences?
cc @come-nc @ChristophWurst