likewinter / queue-throttle
Laravel Beanstalkd Queue Throttle
Installs: 6 108
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- illuminate/queue: ^5.1
- illuminate/support: ^5.1
- pda/pheanstalk: ^3.1
- predis/predis: ^1.0
This package is auto-updated.
Last update: 2021-02-26 14:49:02 UTC
README
Laravel beanstalkd queue throttle
Installing
Laravel
Register service provider by adding in config/app.php
'providers' => [ // Other Service Providers Likewinter\QueueThrottle\QueueThrottleServiceProvider::class ],
Lumen
Register service provider by adding in bootstrap/app.php
$app->register(Likewinter\QueueThrottle\QueueThrottleServiceProvider::class);
Settings
You can set Redis and Beanstalkd hosts in your .env file like
BEANSTALKD_HOST=beanstalkd
REDIS_HOST=redis
Using
Inside your Job class add trait and set limits
use CanLimitRate; protected $rateLimits = [ ['requests' => 10, 'seconds' => 10], ['requests' => 15, 'seconds' => 30], ];
At the begining of handle()
method use throttle
$this->throttle();