Trying to implement Rate Limiting for the queue to run one job per second that makes an HTTP request to external API and load one types of data.
But not getting how to call the job, tried different option but not working. In the example:
Redis::throttle('key')->allow(10)->every(60)->then(function () {
// Job logic...
}, function () {
// Could not obtain lock...
return $this->release(10);
});
What will put in // Job logic...
dispatch the queue and this code will be within the queue class? and how to name the key
? my queue name is loader
.
Any help?