From e8ff3889f5d0389c1f70f3e8f2b3054d187352b2 Mon Sep 17 00:00:00 2001 From: vjpai Date: Tue, 29 Mar 2016 18:31:34 -0700 Subject: [PATCH] Fix scope on an each - no need for class scope --- src/ruby/qps/worker.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ruby/qps/worker.rb b/src/ruby/qps/worker.rb index 1ebf129a13b..8555888106d 100755 --- a/src/ruby/qps/worker.rb +++ b/src/ruby/qps/worker.rb @@ -53,17 +53,18 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service def run_server(reqs) q = EnumeratorQueue.new(self) Thread.new { + bms = '' reqs.each do |req| case req.argtype.to_s when 'setup' - @bms = BenchmarkServer.new(req.setup, @server_port) - q.push(Grpc::Testing::ServerStatus.new(stats: @bms.mark(false), port: @bms.get_port)) + bms = BenchmarkServer.new(req.setup, @server_port) + q.push(Grpc::Testing::ServerStatus.new(stats: bms.mark(false), port: bms.get_port)) when 'mark' - q.push(Grpc::Testing::ServerStatus.new(stats: @bms.mark(req.mark.reset), cores: cpu_cores)) + q.push(Grpc::Testing::ServerStatus.new(stats: bms.mark(req.mark.reset), cores: cpu_cores)) end end q.push(self) - @bms.stop + bms.stop } q.each_item end