[Groonga-commit] droonga/droonga-engine at 7e18d1b [master] Add utility method to do any operation which triggers restarting of the service

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Apr 21 15:33:51 JST 2015


YUKI Hiroshi	2015-04-21 15:33:51 +0900 (Tue, 21 Apr 2015)

  New Revision: 7e18d1bb6ad5d440c1f86d69dbcce0b8a4a14ed1
  https://github.com/droonga/droonga-engine/commit/7e18d1bb6ad5d440c1f86d69dbcce0b8a4a14ed1

  Message:
    Add utility method to do any operation which triggers restarting of the service

  Modified files:
    lib/droonga/serf.rb

  Modified: lib/droonga/serf.rb (+13 -0)
===================================================================
--- lib/droonga/serf.rb    2015-04-21 15:22:24 +0900 (5091f46)
+++ lib/droonga/serf.rb    2015-04-21 15:33:51 +0900 (35bf926)
@@ -218,6 +218,19 @@ module Droonga
       catalog.cluster_id
     end
 
+    CHECK_RESTARTED_INTERVAL = 3
+    CHECK_RESTARTED_TIMEOUT = 60 * 5
+
+    def do_and_wait_restart(&block)
+      start_time = Time.now
+      previous_internal_name = get_tag("internal-name")
+      yield # the given operation must restart the service.
+      while Time.now - start_time < CHECK_RESTARTED_TIMEOUT and
+              get_tag("internal-name") == previous_internal_name
+        sleep(CHECK_RESTARTED_INTERVAL)
+      end
+    end
+
     private
     def ensure_serf
       @serf_command ||= find_system_serf
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index