[Groonga-commit] droonga/droonga-engine at 1e120f3 [master] Initialize payload only when it is available

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Aug 28 19:31:36 JST 2014


YUKI Hiroshi	2014-08-28 19:31:36 +0900 (Thu, 28 Aug 2014)

  New Revision: 1e120f3d8d390dc2fa76b44a9dd9f580c3ef7d96
  https://github.com/droonga/droonga-engine/commit/1e120f3d8d390dc2fa76b44a9dd9f580c3ef7d96

  Message:
    Initialize payload only when it is available

  Modified files:
    lib/droonga/command/serf_event_handler.rb

  Modified: lib/droonga/command/serf_event_handler.rb (+7 -2)
===================================================================
--- lib/droonga/command/serf_event_handler.rb    2014-08-28 19:27:53 +0900 (0b31954)
+++ lib/droonga/command/serf_event_handler.rb    2014-08-28 19:31:36 +0900 (47c6c92)
@@ -26,13 +26,16 @@ module Droonga
         end
       end
 
+      def initialize
+        @payload = nil
+      end
+
       def run
         command_class = detect_command_class
         return true if command_class.nil?
 
         serf_name = ENV["SERF_SELF_NAME"]
-        payload = JSON.parse($stdin.gets)
-        command = command_class.new(serf_name, payload)
+        command = command_class.new(serf_name, @payload)
         command.process if command.should_process?
         output_response(command.response)
         true
@@ -42,8 +45,10 @@ module Droonga
       def detect_command_class
         case ENV["SERF_EVENT"]
         when "user"
+          @payload = JSON.parse($stdin.gets)
           detect_command_class_from_custom_event(ENV["SERF_USER_EVENT"])
         when "query"
+          @payload = JSON.parse($stdin.gets)
           detect_command_class_from_custom_event(ENV["SERF_QUERY_NAME"])
         when "member-join", "member-leave", "member-update", "member-reap"
           Remote::UpdateLiveNodes
-------------- next part --------------
HTML����������������������������...
Download 



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