lib/rocket_job/sliced/slice.rb in rocketjob-5.2.0.beta2 vs lib/rocket_job/sliced/slice.rb in rocketjob-5.2.0.beta3
- old
+ new
@@ -23,12 +23,12 @@
store_in client: "rocketjob_slices"
# The record number of the first record in this slice.
# Useful in knowing the line number of each record in this slice
- # relative to the original file that was uploaded.
- field :first_record_number, type: Integer
+ # relative to the original file that was uploaded. (1-based index)
+ field :first_record_number, type: Integer, default: 1
#
# Read-only attributes
#
@@ -39,11 +39,11 @@
field :started_at, type: Time
# Number of times that this job has failed to process
field :failure_count, type: Integer
- # Number of the record within this slice (not the entire file/job) currently being processed. (One based index)
+ # Number of the record within this slice (not the entire file/job) currently being processed. (1-based index)
field :processing_record_number, type: Integer
# This name of the worker that this job is being processed by, or was processed by
field :worker_name, type: String
@@ -110,10 +110,10 @@
def_instance_delegators :records, :each, :<<, :size, :concat, :at
def_instance_delegators :records, *(Enumerable.instance_methods - Module.methods)
# Returns [Integer] the record number of the record currently being processed relative to the entire file.
def current_record_number
- first_record_number.to_i + processing_record_number.to_i
+ first_record_number + (processing_record_number || 1) - 1
end
# Before Fail save the exception to this slice.
def set_exception(exc = nil)
if exc