rtheunissen / guzzle-rate-limiter Goto Github PK
View Code? Open in Web Editor NEWGuzzle 6 middleware used to delay requests dynamically
Guzzle 6 middleware used to delay requests dynamically
Hello,
I'm looking for example on implementing your rate limiter for Guzzle. Can you point me to a tutorial or simply put a hello world type of example in your reply?
Thanks!
First of all - thanks for providing this middleware, really appreciate it! ๐
I've noticed, that the delay
method actually expects microseconds, but the example provider uses microtime(true)
which does not return microseconds but the current UNIX timestamp in seconds as float (which includes microseconds precision).
There's also a comment The time unit for this value should match the time unit used across this implementation.
in the provider example, which is confusing. It will work using microseconds only actually, because the delay
method uses usleep
which will sleep for the given amount of microseconds - providing seconds or milliseconds would delay just a fraction of the actual desired duration.
Hello,
I was looking at the source code, and was wondering why this middleware does not utilize Guzzle's own delay
request option that is available to be set within a middleware?
http://docs.guzzlephp.org/en/latest/request-options.html#delay-option
http://docs.guzzlephp.org/en/latest/handlers-and-middleware.html#creating-a-handler
Not compatible with "drupal/core": "10.1.6"
Requires "guzzlehttp/guzzle": "^7.5"
Any one copy pasting the example and using it as is will encounter bug where nothing is ever stored and it won't get rate-limited at all. I find it odd that no warning gets thrown for missing 3rd parameter..
laravel/framework#16474
https://laravel.com/docs/5.7/cache#storing-items-in-the-cache
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.