Sha256: 0a3ce527d4a52182b8cf69052f5e334aa49a9d3fcc58823b2ec06776284576f3

Contents?: true

Size: 711 Bytes

Versions: 41

Compression:

Stored size: 711 Bytes

Contents

module Maestrano::Connector::Rails

  # This class process the push to Connec, it use PushToConnecJob for retrocompatibility
  # By using sidekiq-unique-jobs, it makes sure that 2 calls on the same entity, are processed in order
  class PushToConnecWorker
    include Sidekiq::Worker
    sidekiq_options unique: :while_executing, unique_args: :unique_args

    def self.unique_args(args)
      organization_id = args[0]
      entities_hash = args[1]

      [organization_id, entities_hash.keys.sort]
    end

    def perform(organization_id, entities_hash, opts = {})
      organization = Organization.find(organization_id)
      PushToConnecJob.new.perform(organization, entities_hash, opts)
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
maestrano-connector-rails-1.2.2 app/jobs/maestrano/connector/rails/push_to_connec_worker.rb