diff --git a/app/lib/check_cached_fields.rb b/app/lib/check_cached_fields.rb index 601b8b87c..4deb04fe3 100644 --- a/app/lib/check_cached_fields.rb +++ b/app/lib/check_cached_fields.rb @@ -90,13 +90,15 @@ def should_update_cached_field?(options, target) end def index_cached_field(options, value, name, obj) - index_options = { - update_es: options[:update_es], - es_field_name: options[:es_field_name], - update_pg: options[:update_pg], - pg_field_name: options[:pg_field_name], - } - self.delay_for(1.second).index_cached_field_bg(index_options, value, name, obj) + if options[:update_es] || options[:update_pg] + index_options = { + update_es: options[:update_es], + es_field_name: options[:es_field_name], + update_pg: options[:update_pg], + pg_field_name: options[:pg_field_name], + } + self.delay_for(1.second).index_cached_field_bg(index_options, value, name, obj) + end end def index_cached_field_bg(index_options, value, name, obj)