Sha256: f614e54746aee081798db8dd0f8969b5c7c8d972319dce1a9b82b3208a996720
Contents?: true
Size: 862 Bytes
Versions: 3
Compression:
Stored size: 862 Bytes
Contents
# frozen_string_literal: true require 'sidekiq' require 'sidekiq-unique-jobs' module GlobalRegistry #:nodoc: module Bindings #:nodoc: class Worker include Sidekiq::Worker attr_accessor :model delegate :global_registry_entity, to: :model delegate :global_registry_relationship, to: :model def initialize(model = nil) self.model = model end def perform(model_class, id) klass = model_class.is_a?(String) ? model_class.constantize : model_class self.model = klass.find(id) end def self.perform_async(*args) # Set global sidekiq_options worker = set(GlobalRegistry::Bindings.sidekiq_options) if worker == self # sidekiq 4.x super(*args) else # sidekiq 5.x worker.perform_async(*args) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems