wucdbm / guzzle-request-pool
A concurrent GuzzleHttp Request Pool that actually works
Installs: 4 850
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
- guzzlehttp/guzzle: >=7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.8
- wucdbm/php-cs-fixers: ~0.2
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 thecurrent()
method twice, thus trying to send async a promise, or execute it as a function