[Groonga-commit] droonga/fluent-plugin-droonga at 1ac1aaf [master] Modify response of a CRUD operation only when it is successfully processed

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Jan 24 14:12:54 JST 2014


YUKI Hiroshi	2014-01-24 14:12:54 +0900 (Fri, 24 Jan 2014)

  New Revision: 1ac1aafff8d0c15e44d6dec302f3b1e49f6ae4ab
  https://github.com/droonga/fluent-plugin-droonga/commit/1ac1aafff8d0c15e44d6dec302f3b1e49f6ae4ab

  Message:
    Modify response of a CRUD operation only when it is successfully processed

  Modified files:
    lib/droonga/plugin/output_adapter/crud.rb
    lib/droonga/replier.rb

  Modified: lib/droonga/plugin/output_adapter/crud.rb (+3 -1)
===================================================================
--- lib/droonga/plugin/output_adapter/crud.rb    2014-01-24 14:10:27 +0900 (1bc5458)
+++ lib/droonga/plugin/output_adapter/crud.rb    2014-01-24 14:12:54 +0900 (0ff9065)
@@ -21,7 +21,9 @@ module Droonga
 
     command :crud_generic_response
     def crud_generic_response(output_message)
-      output_message.body = output_message.body["success"]
+      if output_message.status_code == Droonga::Replier::STATUS_OK
+        output_message.body = output_message.body["success"]
+      end
     end
   end
 end

  Modified: lib/droonga/replier.rb (+3 -1)
===================================================================
--- lib/droonga/replier.rb    2014-01-24 14:10:27 +0900 (a4ce15d)
+++ lib/droonga/replier.rb    2014-01-24 14:12:54 +0900 (ef125e8)
@@ -15,6 +15,8 @@
 
 module Droonga
   class Replier
+    STATUS_OK = 200.freeze
+
     def initialize(forwarder)
       @forwarder = forwarder
     end
@@ -24,7 +26,7 @@ module Droonga
       destination = message["replyTo"]
       reply_message = {
         "inReplyTo"  => message["id"],
-        "statusCode" => message["statusCode"] || 200,
+        "statusCode" => message["statusCode"] || STATUS_OK,
         "type"       => destination["type"],
         "body"       => message["body"],
       }
-------------- next part --------------
HTML����������������������������...
Download 



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