Welcome to mirror list, hosted at ThFree Co, Russian Federation.

reactive_caching_worker.rb « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6f82ad83137786c955b08cba9aa95167dd9d8a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

class ReactiveCachingWorker
  include ApplicationWorker

  feature_category_not_owned!

  # TODO: The reactive caching worker should be split into
  # two different workers, one for latency_sensitive jobs without external dependencies
  # and another worker without latency_sensitivity, but with external dependencies
  # https://gitlab.com/gitlab-com/gl-infra/scalability/issues/34
  # This worker should also have `worker_has_external_dependencies!` enabled
  latency_sensitive_worker!
  worker_resource_boundary :cpu

  def perform(class_name, id, *args)
    klass = begin
      class_name.constantize
    rescue NameError
      nil
    end
    return unless klass

    klass
      .reactive_cache_worker_finder
      .call(id, *args)
      .try(:exclusively_update_reactive_cache!, *args)
  rescue ReactiveCaching::ExceededReactiveCacheLimit => e
    Gitlab::ErrorTracking.track_exception(e)
  end
end