Retrospring/app/workers/export_worker.rb

23 lines
442 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-01-05 11:54:00 -08:00
class ExportWorker
include Sidekiq::Worker
sidekiq_options queue: :export, retry: 0
2016-01-05 11:54:00 -08:00
# @param user_id [Integer] the user id
def perform(user_id)
user = User.find(user_id)
exporter = Exporter.new(user)
2016-01-05 11:54:00 -08:00
exporter.export
Notification::DataExported.create(
target_id: user.id,
target_type: "User::DataExport",
recipient: user,
new: true
)
2016-01-05 11:54:00 -08:00
end
end