Skip to content

Commit

Permalink
CV2-5420: include cached fields that require ES or PG updates (#2067)
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Oct 4, 2024
1 parent d7b5cad commit 0c8e0f1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/lib/check_cached_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0c8e0f1

Please sign in to comment.