Skip to content

v3.0.0 - Concurrent Job Limiting

Latest

Choose a tag to compare

@parikshit223933 parikshit223933 released this 25 Jul 09:22
· 1 commit to master since this release
5ec361a

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 :concurrent option 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 jobs
  • queue_at_or_over_concurrent_limit?(queue) - Check if at concurrent limit
  • queue_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.