Skip to content

Commit

Permalink
Merge pull request sidekiq#2484 from grosser/grosser/zero
Browse files Browse the repository at this point in the history
prevent invalid concurrency from causing hard to debug problems
  • Loading branch information
mperham committed Aug 12, 2015
2 parents a64333b + 8c82a9f commit a7696ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/sidekiq/manager.rb
Expand Up @@ -27,6 +27,7 @@ def initialize(condvar, options={})
logger.debug { options.inspect }
@options = options
@count = options[:concurrency] || 25
raise ArgumentError, "Concurrency of #{@count} is not supported" if @count < 1
@done_callback = nil
@finished = condvar

Expand Down
5 changes: 5 additions & 0 deletions test/test_manager.rb
Expand Up @@ -88,6 +88,11 @@ def new_manager(opts)
fetcher.verify
end

it 'does not support invalid concurrency' do
assert_raises(ArgumentError) { new_manager(concurrency: 0) }
assert_raises(ArgumentError) { new_manager(concurrency: -1) }
end

describe 'heartbeat' do
before do
uow = Object.new
Expand Down

0 comments on commit a7696ef

Please sign in to comment.