handle parallel reports where no report runners were created
Test Plan: Developer verified: 1) Patchset handles parallel account reports where 0 runners were created. 2) Patchset continues to work correctly with parallel reports running 1+ report runners. Change-Id: I799445f4a6954f43359a71306f504f1fbec54113 Reviewed-on: https://gerrit.instructure.com/157867 Reviewed-by: Rob Orton <rob@instructure.com> Tested-by: Jenkins Product-Review: Mark Valentine <mvalentine@instructure.com> QA-Review: Mark Valentine <mvalentine@instructure.com>
This commit is contained in:
parent
cdf5480a34
commit
bfbcbf2eaf
|
@ -280,7 +280,16 @@ module AccountReports::ReportHelper
|
|||
# we use total_lines to track progress in the normal progress.
|
||||
# just use it here to do the same thing here even though it is not really
|
||||
# the number of lines.
|
||||
@account_report.update_attributes(total_lines: @account_report.account_report_runners.count)
|
||||
total_runners = @account_report.account_report_runners.count
|
||||
|
||||
# If there are no runners, short-circuit and just send back an empty report with headers only.
|
||||
# Otherwise, the report will get stuck in a "running" state and never exit.
|
||||
if total_runners == 0
|
||||
write_report(headers)
|
||||
return
|
||||
end
|
||||
|
||||
@account_report.update_attributes(total_lines: total_runners)
|
||||
|
||||
args = {priority: Delayed::LOW_PRIORITY, max_attempts: 1, n_strand: ["account_report_runner", root_account.global_id]}
|
||||
@account_report.account_report_runners.find_each do |runner|
|
||||
|
|
Loading…
Reference in New Issue