Skip to content

Commit 8d70f8b

Browse files
committed
Better handle nil count
1 parent 6a0377a commit 8d70f8b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/job-iteration/csv_enumerator.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ def batches(batch_size:, cursor:)
4343
.each_slice(batch_size)
4444
.with_index
4545
.drop(count_of_processed_rows(cursor))
46-
.to_enum { (count_of_rows_in_file.to_f / batch_size).ceil }
46+
.to_enum do
47+
num_rows = count_of_rows_in_file
48+
num_rows.nil? ? nil : (num_rows.to_f / batch_size).ceil
49+
end
4750
end
4851

4952
private

0 commit comments

Comments
 (0)