likewinter / queue-throttle
此包已废弃,不再维护。未建议替代包。
Laravel Beanstalkd 队列节流
dev-master
2020-09-26 14:04 UTC
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 队列节流
安装
Laravel
在 config/app.php
中注册服务提供者
'providers' => [ // Other Service Providers Likewinter\QueueThrottle\QueueThrottleServiceProvider::class ],
Lumen
在 bootstrap/app.php
中注册服务提供者
$app->register(Likewinter\QueueThrottle\QueueThrottleServiceProvider::class);
设置
您可以在 .env 文件中设置 Redis 和 Beanstalkd 主机,如下所示:
BEANSTALKD_HOST=beanstalkd
REDIS_HOST=redis
使用
在您的作业类中添加特质并设置限制
use CanLimitRate; protected $rateLimits = [ ['requests' => 10, 'seconds' => 10], ['requests' => 15, 'seconds' => 30], ];
在 handle()
方法开始处使用节流
$this->throttle();