Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove useless removing algolia indexing on article destroy (#1807)
  • Loading branch information
lightalloy authored and benhalpern committed Feb 16, 2019
1 parent f890166 commit 28bac35
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions app/models/article.rb
Expand Up @@ -97,7 +97,7 @@ class Article < ApplicationRecord
where("boost_states ->> 'boosted_dev_digest_email' = 'true'")
}

algoliasearch per_environment: true, enqueue: :trigger_delayed_index do
algoliasearch per_environment: true, auto_remove: false, enqueue: :trigger_delayed_index do
attribute :title
add_index "searchables",
id: :index_id,
Expand Down Expand Up @@ -229,11 +229,10 @@ def index_id
end

def self.trigger_delayed_index(record, remove)
if remove
record.delay.remove_from_index! if record&.persisted?
else
record.index_or_remove_from_index_where_appropriate
end
# on destroy an article is removed from index in a before_destroy callback #before_destroy_actions
return if remove

record.index_or_remove_from_index_where_appropriate
end

def index_or_remove_from_index_where_appropriate
Expand Down

0 comments on commit 28bac35

Please sign in to comment.