Sha256: 5013931ec3c40aa41b13eed066fb3db593090320aab960ff41ce382aaa3e3dba
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 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 if Rails.gem_version < '7' # only works with "classic" loader, not zeitwerk ActiveSupport::Dependencies.mark_for_unload(klass) end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
global-registry-bindings-0.7.1 | lib/global_registry_bindings/workers/pull_mdm_id_worker.rb |