Sha256: a5eccfde60a117c3a3a9f048a051a0c6be2edd9ceba949421f1c4ba01b27f379

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 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
        end

        def perform(model_class, id, type)
          super model_class, id
          self.type = type
          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.1.1 lib/global_registry_bindings/workers/push_relationship_worker.rb
global-registry-bindings-0.1.0 lib/global_registry_bindings/workers/push_relationship_worker.rb