Allow maximum number of workers to be configured per job type. #7
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.
Addresses #3.
We have instances where we would like to have the maximum number of workers depend on the type of Resque Job. For example, we have remote instances that are spun up by a worker, do some work, and then terminate. We could scale this as much as we wanted. In the same project we have workers that are pulling data into the database and we want to limit the number of those so that we aren't overburdening the database server.
This modifies the
Job
module to include amax_workers
method (that becomes a class method for the resque job class that it's extended into). By default this returns the globally set maximum, but can be overridden to define a different value for each class.