Class: SpreeMenuChat::ReembedProductJob

Inherits:
BaseJob
  • Object
show all
Defined in:
app/jobs/spree_menu_chat/reembed_product_job.rb

Overview

Triggered by the Spree::Product after_commit hook (see app/models/spree/product_decorator.rb) whenever a product's embeddable fields change — from a Square sync or a manual admin edit alike, since this hooks the model itself rather than any one sync mechanism.

A failed re-embed just leaves search results stale, not the

"customer paid, nobody knows" severity of SpreeDoordash

DeliveryDispatchJob's failure mode — but it still gets the same retry/ dead-letter shape as every other external-API job in this project, because "silently stale forever" is still a real support burden if a transient Voyage error never gets retried.

Instance Method Summary collapse

Instance Method Details

#perform(product_id) ⇒ Object



18
19
20
21
22
23
# File 'app/jobs/spree_menu_chat/reembed_product_job.rb', line 18

def perform(product_id)
  product = Spree::Product.find_by(id: product_id)
  return unless product

  SpreeMenuChat::Embedder.call(product, store: product.store || Spree::Store.default)
end