From 4785db8cf19899756c4a79462fed861a1d1bd96c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 27 Jun 2011 08:46:28 +0000 Subject: slightly faster worker process spawning It's still O(n) since we don't maintain a reverse mapping of spawned processes, but at least we avoid the extra overhead of creating an array every time. --- lib/unicorn/http_server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index f033764..02ba965 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -465,7 +465,7 @@ class Unicorn::HttpServer def spawn_missing_workers worker_nr = -1 until (worker_nr += 1) == @worker_processes - WORKERS.values.include?(worker_nr) and next + WORKERS.value?(worker_nr) and next worker = Worker.new(worker_nr) before_fork.call(self, worker) if pid = fork -- cgit v1.2.3-24-ge0c7