azphp / async-guzzle-demos-2020 Goto Github PK
View Code? Open in Web Editor NEWDemos for Jeremy's Async Guzzle Presentation - August 2020
License: MIT License
Demos for Jeremy's Async Guzzle Presentation - August 2020
License: MIT License
Guzzle v7.4.2
Takes 20+ seconds:
foreach(range(1, 10) as $request) {
$stack = HandlerStack::create();
$client = new Client(['handler' => $stack]);
$promises[] = $client->getAsync('https://httpbin.org/delay/2');
}
Utils::all($promises)->wait()
Takes 3 seconds:
$stack = HandlerStack::create();
foreach(range(1, 10) as $request) {
$client = new Client(['handler' => $stack]);
$promises[] = $client->getAsync('https://httpbin.org/delay/2');
}
Utils::all($promises)->wait()
I need to process promises produced by various clients with different handler stacks. I have middleware in these stacks that perform auth, etc... So I cannot get away with using 1 stack and 1 client to fulfill every promise. But as you see in the code snippet above, it's not behaving as expected.
I copied your example here line by line into Tinkerwell, and it's also not behaving as expected.
I can always solve the problem with Spatie's Fork, but I've had bad compatibility experiences with it not working on some fpm environments. It's a package that I'm creating, so I'd like to stay as close to native Guzzle as possible.
Let me know if you have anything in mind. If you think it's a bug, I can always open an issue over on Guzzle.
@jeremeamia sorry to bother you, but the record of your talk does not seem to be uploaded to azPHP YouTube channel
Does it exist? Could you please share it somehow?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.