lib/rocket_job/plugins/job/persistence.rb in rocketjob-3.4.3 vs lib/rocket_job/plugins/job/persistence.rb in rocketjob-3.5.0
- old
+ new
@@ -8,12 +8,10 @@
extend ActiveSupport::Concern
included do
# Store all job types in this collection
store_in collection: 'rocket_job.jobs'
-
- after_initialize :remove_arguments
end
module ClassMethods
# Retrieves the next job to work on in priority based order
# and assigns it to this worker
@@ -82,15 +80,15 @@
).each do |result|
counts[result['_id'].to_sym] = result['count']
end
# Calculate :queued_now and :scheduled if there are queued jobs
- if queued_count = counts[:queued]
+ if (queued_count = counts[:queued])
scheduled_count = RocketJob::Job.scheduled.count
- if scheduled_count > 0
+ if scheduled_count.positive?
queued_now_count = queued_count - scheduled_count
- counts[:queued_now] = queued_count - scheduled_count if queued_now_count > 0
+ counts[:queued_now] = queued_count - scheduled_count if queued_now_count.positive?
counts[:scheduled] = scheduled_count
else
counts[:queued_now] = queued_count
end
end
@@ -110,17 +108,9 @@
rocket_job_mark_complete
end
self
end
end
-
- private
-
- # Remove old style arguments that were stored as an array
- def remove_arguments
- attributes.delete('arguments') unless respond_to?('arguments='.to_sym)
- end
-
end
end
end
end