Commit 6040e1ba authored by Valery Sizov's avatar Valery Sizov

ES: fix situation when ES is disabled

parent f24eaccb
...@@ -43,10 +43,20 @@ module ApplicationSearch ...@@ -43,10 +43,20 @@ module ApplicationSearch
} }
} }
} }
if Gitlab.config.elasticsearch.enabled
after_commit on: :create do
ElasticIndexerWorker.perform_async(:index, self.class.to_s, self.id)
end
after_commit ->{ ElasticIndexerWorker.perform_async(:index, self.class.to_s, self.id) }, on: :create after_commit on: :update do
after_commit ->{ ElasticIndexerWorker.perform_async(:update, self.class.to_s, self.id) }, on: :update ElasticIndexerWorker.perform_async(:update, self.class.to_s, self.id)
after_commit ->{ ElasticIndexerWorker.perform_async(:delete, self.class.to_s, self.id) }, on: :destroy end
after_commit on: :destroy do
ElasticIndexerWorker.perform_async(:delete, self.class.to_s, self.id)
end
end
end end
module ClassMethods module ClassMethods
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment