Author: kclark
Date: Tue Jun 17 18:19:28 2008
New Revision: 669029

URL: http://svn.apache.org/viewvc?rev=669029&view=rev
Log:
rb: Give the benchmark server more time to start up

Modified:
    incubator/thrift/trunk/lib/rb/benchmark/benchmark.rb
    incubator/thrift/trunk/lib/rb/benchmark/server.rb

Modified: incubator/thrift/trunk/lib/rb/benchmark/benchmark.rb
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/benchmark/benchmark.rb?rev=669029&r1=669028&r2=669029&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/benchmark/benchmark.rb (original)
+++ incubator/thrift/trunk/lib/rb/benchmark/benchmark.rb Tue Jun 17 18:19:28 
2008
@@ -29,6 +29,8 @@
     return if @serverclass == Object
     args = (File.basename(@interpreter) == "jruby" ? "-J-server" : "")
     @pipe = IO.popen("[EMAIL PROTECTED] #{args} 
#{File.dirname(__FILE__)}/server.rb [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL 
PROTECTED]", "r+")
+    Marshal.load(@pipe) # wait until the server has started
+    sleep 0.2 # give the server time to actually start spawning sockets
   end
 
   def shutdown
@@ -231,8 +233,6 @@
 server = Server.new(args)
 server.start
 
-sleep 0.2 # give the server time to start
-
 args = { :num_processes => 40, :clients_per_process => 5, :host => HOST, :port 
=> PORT }
 args[:interpreter] = ENV['THRIFT_CLIENT_INTERPRETER'] || 
ENV['THRIFT_INTERPRETER'] || "ruby"
 BenchmarkManager.new(args, server).run

Modified: incubator/thrift/trunk/lib/rb/benchmark/server.rb
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/benchmark/server.rb?rev=669029&r1=669028&r2=669029&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/benchmark/server.rb (original)
+++ incubator/thrift/trunk/lib/rb/benchmark/server.rb Tue Jun 17 18:19:28 2008
@@ -50,6 +50,10 @@
   const and const.split('::').inject(Object) { |k,c| k.const_get(c) }
 end
 
+# let our host know that the interpreter has started
+# ideally we'd wait until the server was serving, but we don't have a hook for 
that
+Marshal.dump(:started, STDOUT)
+
 host, port, serverklass = ARGV
 
 Server.start_server(host, port.to_i, resolve_const(serverklass))


Reply via email to