Sha256: c09f80c689c64e1fe6b74c90396886610b4792b95be7c6cbc03e8fb1679d1a0e

Contents?: true

Size: 806 Bytes

Versions: 2

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

module FlowcommerceSpree
  class ImportItemWorker
    include Sidekiq::Worker
    sidekiq_options retry: 3, queue: :flow_io

    sidekiq_retries_exhausted do |message, exception|
      Rails.logger.warn("[!] FlowcommerceSpree::ImportItemWorker max attempts reached: #{message} - #{exception}")
      notification_setting = FlowcommerceSpree::Config.notification_setting
      return unless notification_setting[:slack].present?

      slack_message = "[#{Rails.env}] #{message}"
      Slack_client.chat_postMessage(channel: notification_setting[:slack][:channel], text: slack_message)
    end

    def perform(variant_sku)
      variant = Spree::Variant.find_by sku: variant_sku
      return unless variant

      FlowcommerceSpree::ImportItem.run(variant)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flowcommerce_spree-0.0.9 app/workers/flowcommerce_spree/import_item_worker.rb
flowcommerce_spree-0.0.8 app/workers/flowcommerce_spree/import_item_worker.rb