Navigation Menu

Skip to content

Commit

Permalink
Report count of processed messages per 100 messages
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 10, 2015
1 parent 5b9b738 commit c63a1f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/droonga/plugins/system/absorb_data.rb
Expand Up @@ -55,13 +55,17 @@ def handle
serf = Serf.new(my_node_name)
serf.set_tag("absorbing", true)

count = 0
dumper_error_message = dumper.run do |message|
@messenger.forward(message,
"to" => my_node_name,
"type" => message["type"])
forward("#{prefix}.progress")
count += 1
report_progress(count)
end

forward("#{prefix}.progress", "count" => count)

serf.set_tag("absorbing", true)

if dumper_error_message
Expand All @@ -84,6 +88,11 @@ def dumper_params
}
end

def report_progress(count)
return unless (count % 100).zero?
forward("#{prefix}.progress", "count" => count)
end

def myself
@myself ||= NodeName.parse(my_node_name)
end
Expand Down

0 comments on commit c63a1f0

Please sign in to comment.