Throttling
Throttling allows you to limit the rate at which jobs are processed to prevent overloading your system or external services. You can define a throttle when creating a queue:
JoobQ.configure do |config|
config.queue "api_calls", 3, ApiJob, throttle: { limit: 5, period: 10.seconds }
end
In this example, only three workers will process ApiJob
, and each job will be throttled to run at a minimum interval of 5 seconds between executions.
Last updated
Was this helpful?