Robust and more Strict job throttling#20
Open
parikshit223933 wants to merge 10 commits intomalomalo:masterfrom
Open
Robust and more Strict job throttling#20parikshit223933 wants to merge 10 commits intomalomalo:masterfrom
parikshit223933 wants to merge 10 commits intomalomalo:masterfrom
Conversation
This commit adds the ability to limit the number of jobs that can run concurrently for a queue, in addition to the existing rate limiting functionality. Key changes: - Add :concurrent option to rate_limit configuration - Track active jobs using Redis counters - Override Worker#perform to increment/decrement active job counts - Check concurrent limits in Worker#reserve before starting new jobs - Add methods: active_job_count, queue_at_or_over_concurrent_limit?, etc. - Update README with examples and documentation This feature helps prevent resource exhaustion and database lock accumulation when jobs take longer than the rate limit window. Example usage: Resque.rate_limit(:my_queue, at: 5, per: 5, concurrent: 3) This ensures max 5 jobs start per 5 seconds AND max 3 jobs run concurrently. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ting Add concurrent job limiting feature
- Major version bump for new concurrent limiting feature - Updated gem description to reflect new functionality
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have two machines running on production all the time and 10 workers are running on each machine. We were having trouble with resque throttler because throttling was not precise. sometimes it would dequeue jobs mentioned in the throttling config and sometimes more than that. We needed strict throttline as per the given config. This PR ensures that.
Let me know your opinion on the same.