Sha256: 63ab62d7f7b21548990eaf3e97b7eeded0dc0ca228977b879363e158c8050375

Contents?: true

Size: 1.06 KB

Versions: 18

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'global_registry_bindings/worker'
require 'global_registry_bindings/entity/relationship_type_methods'
require 'global_registry_bindings/entity/push_relationship_methods'

module GlobalRegistry #:nodoc:
  module Bindings #:nodoc:
    module Workers #:nodoc:
      class PushRelationshipWorker < GlobalRegistry::Bindings::Worker
        include GlobalRegistry::Bindings::Entity::RelationshipTypeMethods
        include GlobalRegistry::Bindings::Entity::PushRelationshipMethods
        sidekiq_options unique: :until_and_while_executing

        attr_accessor :type

        def initialize(model = nil, type = nil)
          super model
          self.type = type.to_sym if type
        end

        def perform(model_class, id, type)
          super model_class, id
          self.type = type.to_sym
          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

18 entries across 18 versions & 1 rubygems

Version Path
global-registry-bindings-0.6.2 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.6.1 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.6.0 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.5.0 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.4.0 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.3.3 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.3.2 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.3.1 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.3.0 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.2.0 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.1.9 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.1.8 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.1.7 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.1.6 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.1.5 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.1.4 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.1.3 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.1.2 lib/global_registry_bindings/workers/push_relationship_worker.rb