Sha256: 7868d559e1515d690e38812cbe5d18f325d142b41e1a4e5e536096dbcf4215c0
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true require "global_registry_bindings/entity/mdm_methods" module GlobalRegistry # :nodoc: module Bindings # :nodoc: module Workers # :nodoc: def self.mdm_worker_class(model_class) worker_class_name = model_class.global_registry_entity.mdm_worker_class_name return const_get worker_class_name if const_defined? worker_class_name klass = Class.new(PullMdmIdWorker) do sidekiq_options unique: :until_timeout, unique_expiration: model_class.global_registry_entity.mdm_timeout end const_set worker_class_name, klass ActiveSupport::Dependencies.mark_for_unload(klass) klass end class PullMdmIdWorker < ::GlobalRegistry::Bindings::Worker include GlobalRegistry::Bindings::Entity::MdmMethods def perform(model_class, id) super model_class, id pull_mdm_id_from_global_registry rescue ActiveRecord::RecordNotFound # If the record was deleted after the job was created, swallow it nil rescue RestClient::ResourceNotFound Rails.logger.info "GR entity for #{self.class.name} #{id} does not exist; will _not_ retry" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
global-registry-bindings-0.7 | lib/global_registry_bindings/workers/pull_mdm_id_worker.rb |
global-registry-bindings-0.6.3 | lib/global_registry_bindings/workers/pull_mdm_id_worker.rb |