likewinter/queue-throttle

How to use it?

Closed this issue · 2 comments

Hi

Your project is really interesting and I'm trying to understand how to use it.

I analyzed the code but I didn't understand how you determine which of queue drivers to intervene between Redis and Beanstalkd.

In addition, why $rateLimits attribute is a vector of vectors and declares two different configurations for requests/seconds?

Can you explain something more thanks?

I will be happy to help with the documentation and code if you would.

Hi

Thanks for the interest.

I analyzed the code, but I didn't understand how you determine which of queue drivers to intervene between Redis and Beanstalkd.

There is nothing about choosing queue driver; the only queue supported by the package is beanstalk (because as far as I know, it's the only queue that supports pausing the whole tube, not delaying tasks each one by one) and Redis for counters.

In addition, why $rateLimits attribute is a vector of vectors and declares two different configurations for requests/seconds?

The central case of using this package is to throttle requests to 3rd party API. There is a distinct situation when API use various restrictions like one req/sec but not more than 15 per 30 seconds (which equal 0.5 req/sec), so you need to throttle it in multiple ways. That's why you can set two or more configurations.

If you don't like the idea to pause the whole tube or do not want to stick with Redis/Beanstalk stack you can use native Laravel queue throttling, it works nice with any queue driver but still using Redis for counters.

I'll appreciate any help with documentation or code.

Thank you, I was then clear about the mechanism used and it is particularly ingenious congratulations.

As soon as I have a moment I'll write some documentation about it, so it will be more intuitive for other users to understand how it works.