YUKI Hiroshi
null+****@clear*****
Fri Apr 10 15:35:09 JST 2015
YUKI Hiroshi 2015-04-10 15:35:09 +0900 (Fri, 10 Apr 2015) New Revision: ac2aa421f835ba08ce82ef398cb1dbc00b44a554 https://github.com/droonga/droonga-engine/commit/ac2aa421f835ba08ce82ef398cb1dbc00b44a554 Message: Fill missing "date" field by HandlerMessenger itself Modified files: lib/droonga/handler_messenger.rb lib/droonga/plugins/system/absorb_data.rb Modified: lib/droonga/handler_messenger.rb (+9 -0) =================================================================== --- lib/droonga/handler_messenger.rb 2015-04-10 15:33:10 +0900 (9790330) +++ lib/droonga/handler_messenger.rb 2015-04-10 15:35:09 +0900 (26d5069) @@ -13,6 +13,8 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +require "time" + require "droonga/replier" require "droonga/forwarder" @@ -106,6 +108,7 @@ module Droonga # # @see Forwarder#forward def forward(droonga_message, destination) + droonga_message["date"] ||= new_date @forwarder.forward(droonga_message, destination) end @@ -117,5 +120,11 @@ module Droonga def log_tag "[#{Process.ppid}] handler_messenger" end + + MICRO_SECONDS_DECIMAL_PLACE = 6 + + def new_date + Time.now.utc.iso8601(MICRO_SECONDS_DECIMAL_PLACE) + end end end Modified: lib/droonga/plugins/system/absorb_data.rb (+0 -9) =================================================================== --- lib/droonga/plugins/system/absorb_data.rb 2015-04-10 15:33:10 +0900 (d445d59) +++ lib/droonga/plugins/system/absorb_data.rb 2015-04-10 15:35:09 +0900 (01732a3) @@ -13,8 +13,6 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -require "time" - require "droonga/plugin" require "droonga/catalog/dataset" require "droonga/node_name" @@ -51,7 +49,6 @@ module Droonga serf.set_tag("absorbing", true) error_message = dumper.run do |message| - message["date"] ||= new_date @messenger.forward(message, "to" => my_node_name, "type" => message["type"]) @@ -86,12 +83,6 @@ module Droonga def my_node_name @messenger.engine_state.name end - - MICRO_SECONDS_DECIMAL_PLACE = 6 - - def new_date - Time.now.utc.iso8601(MICRO_SECONDS_DECIMAL_PLACE) - end end define_single_step do |step| -------------- next part -------------- HTML����������������������������...Descargar