gitlab-org--gitlab-foss/app/workers/reactive_caching_worker.rb
Sarah Yasonik e6fcdd7aca Update Metrics references to Object path
On reload, references to Metrics within classes in the Gitlab::Metrics
module fail. Update all references to ::Gitlab::Metrics so that
constant lookup finds the right module in development. This fix should
not impact production.
2019-02-14 18:05:35 +00:00

18 lines
424 B
Ruby

# frozen_string_literal: true
class ReactiveCachingWorker
include ApplicationWorker
# rubocop: disable CodeReuse/ActiveRecord
def perform(class_name, id, *args)
klass = begin
class_name.constantize
rescue NameError
nil
end
return unless klass
klass.find_by(klass.primary_key => id).try(:exclusively_update_reactive_cache!, *args)
end
# rubocop: enable CodeReuse/ActiveRecord
end