Moved to background jobs for search indexing.
This commit is contained in:
parent
b4be5da97c
commit
eb47a0c2c8
1 changed files with 11 additions and 1 deletions
|
@ -488,7 +488,10 @@ update search index, if configured - will be executed automatically
|
||||||
|
|
||||||
def search_index_update
|
def search_index_update
|
||||||
return if !self.class.search_index_support_config
|
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
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -783,4 +786,11 @@ destory object dependencies, will be executed automatically
|
||||||
def destroy_dependencies
|
def destroy_dependencies
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue