Skip to content

Commit

Permalink
fixed occasional "invalid argument" error
Browse files Browse the repository at this point in the history
fixes #46
  • Loading branch information
kzk committed Dec 23, 2014
1 parent 37fa1a7 commit 24516e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/unicorn/worker_killer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def self.new(app, memory_limit_min = (1024**3), memory_limit_max = (2*(1024**3))
end

def randomize(integer)
RUBY_VERSION > "1.9" ? Random.rand(integer) : rand(integer)
RUBY_VERSION > "1.9" ? Random.rand(integer.abs) : rand(integer)
end

def process_client(client)
Expand Down Expand Up @@ -85,7 +85,7 @@ def self.new(app, max_requests_min = 3072, max_requests_max = 4096, verbose = fa
end

def randomize(integer)
RUBY_VERSION > "1.9" ? Random.rand(integer) : rand(integer)
RUBY_VERSION > "1.9" ? Random.rand(integer.abs) : rand(integer)
end

def process_client(client)
Expand Down

0 comments on commit 24516e7

Please sign in to comment.