Export daemon process of search index updating to a method

parent 75ecb8fe
...@@ -190,8 +190,8 @@ module Pod ...@@ -190,8 +190,8 @@ module Pod
def save_search_index(index) def save_search_index(index)
require 'json' require 'json'
@updated_search_index = index @updated_search_index = index
File.open(search_index_path, 'w') do |file| search_index_path.open('w') do |io|
file.write(@updated_search_index.to_json) io.write(@updated_search_index.to_json)
end end
end end
...@@ -239,6 +239,15 @@ module Pod ...@@ -239,6 +239,15 @@ module Pod
save_search_index(search_index) if search_index save_search_index(search_index) if search_index
end end
# Updates search index for changed pods in background
def update_search_index_if_needed_in_background(changed_spec_paths)
Process.fork do
Process.daemon
update_search_index_if_needed(changed_spec_paths)
exit
end
end
# Updates the local clone of the spec-repo with the given name or of all # Updates the local clone of the spec-repo with the given name or of all
# the git repos if the name is omitted. # the git repos if the name is omitted.
# #
...@@ -262,12 +271,8 @@ module Pod ...@@ -262,12 +271,8 @@ module Pod
check_version_information(source.repo) check_version_information(source.repo)
end end
end end
# Perform search index update operation as a subprocess. # Perform search index update operation in background.
Process.fork do update_search_index_if_needed_in_background(changed_spec_paths)
Process.daemon
update_search_index_if_needed(changed_spec_paths)
exit
end
end end
# Returns whether a source is a GIT repo. # Returns whether a source is a GIT repo.
......
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