Class: Spree::ExportSubscriber
- Inherits:
-
Subscriber
- Object
- Subscriber
- Spree::ExportSubscriber
- Defined in:
- app/subscribers/spree/export_subscriber.rb
Overview
Handles Export lifecycle events.
This subscriber replaces the following callbacks in Spree::Export:
-
after_commit :generate_async, on: :create
When an export is created, this subscriber triggers the async generation job.
We use async: false because this subscriber just queues a background job, so there’s no benefit to running the subscriber itself asynchronously.
Instance Method Summary collapse
Methods inherited from Subscriber
#call, call, event_handlers, #handle, on, subscribes_to, subscription_options, subscription_patterns
Instance Method Details
#generate_export_async(event) ⇒ Object
19 20 21 22 23 24 |
# File 'app/subscribers/spree/export_subscriber.rb', line 19 def generate_export_async(event) export_id = event.payload['id'] return unless export_id Spree::Exports::GenerateJob.perform_later(export_id) end |