Sha256: 0db3ec188963dd02aa30c23aaaca7be848790be60a8a2a6dfb540ee68da9d915

Contents?: true

Size: 683 Bytes

Versions: 2

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

require 'sidekiq'
require 'sidekiq-unique-jobs'

module GlobalRegistry #:nodoc:
  module Bindings #:nodoc:
    module Workers #:nodoc:
      class PushRelationshipWorker
        include Sidekiq::Worker
        sidekiq_options unique: :until_and_while_executing

        def perform(model_class, id)
          klass = model_class.is_a?(String) ? model_class.constantize : model_class
          klass.find(id).send(:push_relationship_to_global_registry)
        rescue ActiveRecord::RecordNotFound # rubocop:disable Lint/HandleExceptions
          # If the record was deleted after the job was created, swallow it
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
global-registry-bindings-0.0.6 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.0.5 lib/global_registry_bindings/workers/push_relationship_worker.rb