wucdbm/guzzle-request-pool

A concurrent GuzzleHttp Request Pool that actually works

v0.1.3 2024-04-09 20:48 UTC

This package is auto-updated.

Last update: 2024-04-09 20:51:18 UTC


README

Tired of your GuzzleHttp request pool randomly not working?

Tired of trying to get concurrency just right so Guzzle will actually execute ALL of your requests?

Tired of pulling your hair because your last async request is not executing and you don't know why?

You've come to the right place!

Just use Wucdbm\GuzzleHttp\Pool like you would GuzzleHttp\Pool and enjoy cold beer ;)

composer require wucdbm/guzzle-request-pool

In fact, Guzzle's Pool was working fine for the most part, except several lines of code where the design was plain wrong. The problem manifests itself when you send an arbitrary number of additional requests from your fulfilled handlers. This library solves that problem.

Credits to the GuzzleHttp team for creating this awesome library and the pool, I just fixed it. As my changes swayed away from just one or two lines of code during development, I decided to publish this small library instead. It should be fully compatible with Guzzle "guzzlehttp/guzzle": "~6.0". If you encounter any issues, please let me know.

Original comments from Guzzle's code I used as a base are (mostly) preserved.

TODO

  • IteratorWrapper should check if $requests instanceof static, and then do $this->iterator = $requests->iterator; because else we'd be calling the current() method twice, thus trying to send async a promise, or execute it as a function