Major Release: Concurrent Job Limiting
This release adds the ability to limit how many jobs can run concurrently for a queue, in addition to the existing rate limiting functionality.
New Features
- Concurrent Job Limiting: New
:concurrentoption to limit simultaneous job execution - Active Job Tracking: Real-time tracking of running jobs using Redis counters
- Resource Protection: Prevents database lock accumulation and resource exhaustion
Usage
# Allow 5 jobs to start per 5 seconds, but only 3 can run concurrently
Resque.rate_limit(:my_queue, at: 5, per: 5, concurrent: 3)API Additions
active_job_count(queue)- Get number of currently running jobsqueue_at_or_over_concurrent_limit?(queue)- Check if at concurrent limitqueue_has_concurrent_limit?(queue)- Check if concurrent limit is configured
Compatibility
✅ Fully backward compatible - Existing rate limits continue to work unchanged. The concurrent limiting is only active when the :concurrent option is specified.
Installation
gem 'resque-throttler', '~> 3.0.0'Or download the gem file attached to this release.