Limit progress updates to 99%
Progress is stored as an integer but we were sending a float here, this caused large imports to report 100% progress when they could have been as little as 99.5% complete. For small batches this isn't an issue but for very large customers this 1/2 percent could be many minutes to hours. Fixes: SIS-1403 Change-Id: I9fdcd3133e26a860c85a239652127184c179eab2 Reviewed-on: https://gerrit.instructure.com/62518 Reviewed-by: Rob Orton <rob@instructure.com> Tested-by: Jenkins QA-Review: Jeremy Putnam <jeremyp@instructure.com> Product-Review: Tyler Pickett <tpickett@instructure.com>
This commit is contained in:
parent
f078b44e8d
commit
6a9825d9a6
|
@ -248,12 +248,12 @@ class SisBatch < ActiveRecord::Base
|
|||
if import_finished
|
||||
remove_previous_imports if self.batch_mode?
|
||||
self.workflow_state = :imported
|
||||
self.progress = 100
|
||||
self.workflow_state = :imported_with_messages if messages?
|
||||
else
|
||||
self.workflow_state = :failed
|
||||
self.workflow_state = :failed_with_messages if messages?
|
||||
end
|
||||
self.progress = 100
|
||||
self.ended_at = Time.now.utc
|
||||
self.save
|
||||
end
|
||||
|
|
|
@ -220,6 +220,10 @@ module SIS
|
|||
@warnings << [ csv ? csv[:file] : "", message ]
|
||||
end
|
||||
|
||||
def calculate_progress
|
||||
(((@current_row.to_f/@total_rows) * @progress_multiplier) + @progress_offset) * 100
|
||||
end
|
||||
|
||||
def update_progress
|
||||
@current_row += 1
|
||||
@current_row_for_pause_vars += 1
|
||||
|
@ -231,7 +235,7 @@ module SIS
|
|||
@batch.reload(select: 'data, progress', lock: :no_key_update)
|
||||
@current_row += @batch.data[:current_row]
|
||||
@batch.data[:current_row] = @current_row
|
||||
@batch.progress = (((@current_row.to_f/@total_rows) * @progress_multiplier) + @progress_offset) * 100
|
||||
@batch.progress = [calculate_progress, 99].min
|
||||
@batch.save
|
||||
@current_row = 0
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue