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
|
|
|
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2017-01-12 17:31:02 -05:00
|
|
|
def perform(class_name, id, *args)
|
2016-12-16 23:09:50 -05:00
|
|
|
klass = begin
|
|
|
|
Kernel.const_get(class_name)
|
|
|
|
rescue NameError
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
return unless klass
|
|
|
|
|
2017-01-12 17:31:02 -05:00
|
|
|
klass.find_by(id: id).try(:exclusively_update_reactive_cache!, *args)
|
2016-12-16 23:09:50 -05:00
|
|
|
end
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2016-12-16 23:09:50 -05:00
|
|
|
end
|