Sha256: bbbe391345aa49745706db3ceb7d57bc886ad38f430fee35e3afe52f027857aa

Contents?: true

Size: 476 Bytes

Versions: 3

Compression:

Stored size: 476 Bytes

Contents

module Workarea
  class UpdatePackageProducts
    include Sidekiq::Worker
    include Sidekiq::CallbacksWorker

    sidekiq_options(
      enqueue_on: { Catalog::Product => :destroy },
      unique: :until_executing
    )

    def perform(id)
      Sidekiq::Callbacks.inline do
        packages = Catalog::Product.where(product_ids: id)
        packages.each do |package|
          package.product_ids.delete(id)
          package.save
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-package_products-3.4.1 app/workers/workarea/update_package_products.rb
workarea-package_products-3.4.0 app/workers/workarea/update_package_products.rb
workarea-package_products-3.3.3 app/workers/workarea/update_package_products.rb