2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-16 23:09:50 -05:00
|
|
|
class ReactiveCachingWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2016-12-16 23:09:50 -05:00
|
|
|
|
2019-10-18 07:11:44 -04:00
|
|
|
feature_category_not_owned!
|
|
|
|
|
2019-10-30 11:14:17 -04:00
|
|
|
# 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
|
|
|
|
|
2017-01-12 17:31:02 -05:00
|
|
|
def perform(class_name, id, *args)
|
2016-12-16 23:09:50 -05:00
|
|
|
klass = begin
|
2019-02-14 13:05:35 -05:00
|
|
|
class_name.constantize
|
2016-12-16 23:09:50 -05:00
|
|
|
rescue NameError
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
return unless klass
|
|
|
|
|
2019-04-04 13:27:29 -04:00
|
|
|
klass
|
|
|
|
.reactive_cache_worker_finder
|
|
|
|
.call(id, *args)
|
|
|
|
.try(:exclusively_update_reactive_cache!, *args)
|
2016-12-16 23:09:50 -05:00
|
|
|
end
|
|
|
|
end
|