Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

likewinter/queue-throttle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED: use a built-in queue agnostic implementation throttle mechanism from Laravel Framework

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();

Releases

No releases published

Packages

No packages published

Languages