Moved to background jobs for search indexing.

This commit is contained in:
Martin Edenhofer 2014-02-03 19:27:49 +01:00
parent b4be5da97c
commit eb47a0c2c8

View file

@ -488,7 +488,10 @@ update search index, if configured - will be executed automatically
def search_index_update
return if !self.class.search_index_support_config
search_index_update_backend
# start background job to transfer data to search index
return if !SearchIndexBackend.enabled?
Delayed::Job.enqueue( ApplicationModel::Job.new( self.class.to_s, self.id ) )
end
=begin
@ -783,4 +786,11 @@ destory object dependencies, will be executed automatically
def destroy_dependencies
end
# perform background job
class ApplicationModel::Job < Struct.new( :object, :o_id )
def perform
Object.const_get(object).find(o_id).search_index_update_backend
end
end
end