Skip to content

Commit

Permalink
Fill missing "date" parameter of forwarding message
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 10, 2015
1 parent f6149ca commit b305c08
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/droonga/plugins/system/absorb_data.rb
Expand Up @@ -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/plugin"
require "droonga/catalog/dataset"
require "droonga/node_name"
Expand Down Expand Up @@ -49,6 +51,7 @@ def handle(message)
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"])
Expand Down Expand Up @@ -83,6 +86,12 @@ def myself
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|
Expand Down

0 comments on commit b305c08

Please sign in to comment.