Class: Spree::DataRequests::ProcessJob
- Defined in:
- app/jobs/spree/data_requests/process_job.rb
Overview
Builds the export (or runs the erasure) for a data subject request off the request cycle.
A request that fails is recorded as failed with its message rather
than left in processing, because a request stuck mid-flight would
block the subject from asking again — the pending-request check is what
rate-limits them. That is why the work is wrapped rather than left to
raise: the base class's retries cover the transient database errors, and
anything else has to leave the request in a state the subject can act on.
Its own queue: an export reads a person's whole history and a statutory clock is running on it, so a shop with a long import backlog should be able to give these their own workers.
Constant Summary
Constants inherited from BaseJob
Instance Method Summary collapse
Instance Method Details
#perform(data_request_id) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/jobs/spree/data_requests/process_job.rb', line 19 def perform(data_request_id) data_request = Spree::DataRequest.find_by_prefix_id!(data_request_id) result = Spree::DataRequests::Fulfill.call(data_request: data_request) record_failure(data_request, result.error.to_s) if result.failure? rescue StandardError => e record_failure(data_request, e.) if data_request raise end |