[Groonga-commit] groonga/grntest [master] Ensure groonga ready in HTTP mode

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 6日 (水) 17:25:50 JST


Haruka Yoshihara	2012-06-06 17:25:50 +0900 (Wed, 06 Jun 2012)

  New Revision: a490a4e8a04c4b40d5f2551a3b7e5d31a7826534

  Log:
    Ensure groonga ready in HTTP mode

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+12 -3)
===================================================================
--- lib/groonga/tester.rb    2012-06-06 17:25:17 +0900 (0d4007f)
+++ lib/groonga/tester.rb    2012-06-06 17:25:50 +0900 (7b0832b)
@@ -330,12 +330,21 @@ module Groonga
         options = {}
         pid = Process.spawn(env, *command_line, options)
         begin
-          open("http://#{host}:#{port}/d/status") do
-          end
           executor = HTTPExecutor.new(host, port, context)
+          n_retried = 0
+          begin
+            executor.send_command("status")
+          rescue SystemCallError
+            n_retried += 1
+            sleep(0.1)
+            retry if n_retried < 10
+            raise
+          end
           yield(executor)
         ensure
-          open("http://#{host}:#{port}/d/shutdown") do
+          begin
+            executor.send_command("shutdown")
+          rescue SystemCallError
           end
           Process.waitpid(pid)
         end




Groonga-commit メーリングリストの案内
Back to archive index