Class: SpreeMenuChat::ReembedCatalogJob
- Defined in:
- app/jobs/spree_menu_chat/reembed_catalog_job.rb
Overview
Full-catalog re-embed — every non-deleted, non-archived product plus every Spree::Policy for the store. Used for first-time backfill and the admin "rebuild index" action (M6); the day-to-day path is ReembedProductJob's per-product hook, not this.
A coarse full pass is fine at restaurant-menu scale — same rationale spree_square's own CatalogWebhookJob comment gives for its full re-import on Square's equally coarse catalog.version.updated webhook.
Instance Method Summary collapse
Instance Method Details
#perform(store_id = nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/jobs/spree_menu_chat/reembed_catalog_job.rb', line 15 def perform(store_id = nil) store = store_id ? Spree::Store.find(store_id) : Spree::Store.default store.products.not_deleted.not_archived.find_each do |product| SpreeMenuChat::Embedder.call(product, store: store) end Spree::Policy.for_store(store).find_each do |policy| SpreeMenuChat::Embedder.call(policy, store: store) end end |