dawarich/app/jobs/points/create_job.rb

18 lines
383 B
Ruby
Raw Normal View History

2025-01-20 10:37:15 -05:00
# frozen_string_literal: true
class Points::CreateJob < ApplicationJob
queue_as :default
def perform(params, user_id)
data = Points::Params.new(params, user_id).call
2025-01-20 10:37:15 -05:00
data.each_slice(1000) do |location_batch|
Point.upsert_all(
location_batch,
2025-01-20 14:41:26 -05:00
unique_by: %i[latitude longitude timestamp user_id],
returning: false
)
2025-01-20 10:37:15 -05:00
end
end
end