Skip to content

Commit

Permalink
Use given messagesPerSecond parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 14, 2015
1 parent 32abafc commit 6d3438f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/droonga/plugins/system/absorb_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ def dumper_params
:loop => @loop,
},

:messages_per_second => params["messagesPerSecond"] ||
DEFAULT_MESSAGES_PER_SECOND,
:messages_per_second => messages_per_second,
}
end

Expand All @@ -130,7 +129,7 @@ def progress_percentage
def progress_message
n_remaining_records = [@total_n_source_records - @n_processed_messages, 0].max

remaining_seconds = n_remaining_records / @messages_per_second
remaining_seconds = n_remaining_records / messages_per_second
remaining_hours = (remaining_seconds / ONE_HOUR_IN_SECONDS).floor
remaining_seconds -= remaining_hours * ONE_HOUR_IN_SECONDS
remaining_minutes = (remaining_seconds / ONE_MINUTE_IN_SECONDS).floor
Expand Down Expand Up @@ -185,6 +184,11 @@ def source_dataset
Catalog::Dataset::DEFAULT_NAME
end

def messages_per_second
@messages_per_second ||= @request.request["messagesPerSecond"] ||
DEFAULT_MESSAGES_PER_SECOND
end

def source_client_options
{
:host => source_host,
Expand Down

0 comments on commit 6d3438f

Please sign in to comment.